CN108111431B - Service data sending method, device, computing equipment and computer readable storage medium - Google Patents
Service data sending method, device, computing equipment and computer readable storage medium Download PDFInfo
- Publication number
- CN108111431B CN108111431B CN201611052698.7A CN201611052698A CN108111431B CN 108111431 B CN108111431 B CN 108111431B CN 201611052698 A CN201611052698 A CN 201611052698A CN 108111431 B CN108111431 B CN 108111431B
- Authority
- CN
- China
- Prior art keywords
- weight
- long connection
- port
- tcp
- tcp long
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 56
- 230000005540 biological transmission Effects 0.000 claims description 13
- 230000004044 response Effects 0.000 claims description 5
- 238000011084 recovery Methods 0.000 claims 2
- 238000013459 approach Methods 0.000 description 6
- 238000004891 communication Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- 230000000694 effects Effects 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 238000010187 selection method Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 2
- 238000001514 detection method Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/12—Avoiding congestion; Recovering from congestion
- H04L47/125—Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The application provides a service data sending method, which comprises the following steps: establishing a TCP long connection for each IP port of a data receiving end; configuring a first weight for each TCP long connection; and when sending a service data packet to the data receiving end, executing the following processing: determining a second weight of each TCP long connection; wherein the second weight of a TCP long connection is determined according to the number of times that service data packets have been sent through the TCP long connection; selecting one TCP long connection according to the first weight and the second weight of each TCP long connection, so that the difference between the second weight and the first weight of the selected TCP long connection is smaller; and sending the service data packet through the selected TCP long connection. The application also provides a corresponding device. By adopting the scheme, the load balance of the long TCP connection can be realized.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for transmitting service data.
Background
Currently, some devices need to transmit data based on Transmission Control Protocol (TCP), such as: long TCP connections may be established between devices, such as between platform servers. Multiple data packets can be continuously transmitted on one long TCP connection, and if no data packet is transmitted during the long TCP connection holding period, both sides are required to transmit a link detection packet.
As a device at a data transmitting end, a TCP long connection may be established with a plurality of IP ports at a data receiving end, and then when transmitting a service data packet, one of the plurality of TCP long connections needs to be selected to complete transmission. After the service data packet is sent for multiple times, the sent times of each TCP long connection are different, or the data processing load of the device or process where the IP port corresponding to each TCP long connection is located is different. In addition, the processing power and response speed of each device or process may be different. Then load balancing of these TCP long connections is required.
Disclosure of Invention
The application provides a service data sending method, which comprises the following steps: establishing a TCP long connection for each IP port of a data receiving end; configuring a first weight for each TCP long connection; and when sending a service data packet to the data receiving end, executing the following processing: determining a second weight of each TCP long connection; wherein the second weight of a TCP long connection is determined according to the number of times that service data packets have been sent through the TCP long connection; selecting one TCP long connection according to the first weight and the second weight of each TCP long connection, so that the difference between the second weight and the first weight of the selected TCP long connection is smaller; and sending the service data packet through the selected TCP long connection.
The present application further provides a service data sending apparatus, including: the connection establishing module is used for establishing a Transmission Control Protocol (TCP) long connection for each IP port of the data receiving end; the weight configuration module is used for configuring a first weight for each TCP long connection; the data sending module, when sending a service data packet to the data receiving end, triggers the weight determining module and the selecting module to execute the following processing: the weight determining module is used for determining a second weight of each TCP long connection; wherein the second weight of a TCP long connection is determined according to the number of times that service data packets have been sent through the TCP long connection; the selection module selects one TCP long connection according to the first weight and the second weight of each TCP long connection, so that the difference between the second weight and the first weight of the selected TCP long connection is smaller; and the data sending module sends the service data packet through the TCP long connection selected by the selection module.
By adopting the scheme provided by the application, the load balance aiming at the long connection of the TCP can be realized.
Drawings
In order to more clearly illustrate the technical solutions in the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only examples of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive effort. Wherein,
FIG. 1 is a diagram of a system architecture to which an example of the present application relates;
FIG. 2 is a flow chart of a method of an example of the present application;
FIG. 3 is a flow chart of a method of an example of the present application;
FIG. 4 is a schematic diagram of the structure of the device according to the example of the present application; and
FIG. 5 is a block diagram of a computing device in an example of the present application.
Detailed Description
For simplicity and clarity of description, the invention will be described below by describing several representative embodiments. Not all embodiments are shown herein. In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention. Some embodiments are not described in detail, but rather are merely provided as frameworks, in order to avoid unnecessarily obscuring aspects of the invention. Hereinafter, "including" means "including but not limited to", "according to … …" means "at least according to … …, but not limited to … … only". The word "comprising" in the description and in the claims is intended to include at least to some extent, and should be interpreted as including other features which may be present in addition to those mentioned later.
The application example provides a service data sending method, which realizes service data sending based on TCP long connection. The method can be applied to any equipment capable of serving as a data sending end, such as server equipment in an advertisement transaction platform (ADX), a supplier platform (SSP), a Demand Side Platform (DSP) and the like in an internet advertisement system, or various terminal equipment such as a PC, a tablet, a mobile phone, wearable equipment and the like.
Fig. 1 shows a system architecture diagram to which an example of the present application relates. As shown in fig. 1, the system architecture includes a transmitting end 101 and two receiving ends 102 (a receiving end 1 and a receiving end 2), where the receiving end 1 includes IP ports 1 to 3, and the receiving end 2 includes IP ports 4 to 6. The sending end 101 establishes TCP long connections with IP ports on receiving ends, respectively, to send service data packets (for example, various service requests such as accessing web pages and obtaining data) by using the TCP long connections, and the data volume of each service data packet is different, and the data volume of one service data packet is related to the current service processing needs, for example: a service request currently sent is delivered to the receiving end via a service data packet, and the data volume of the service data packet is determined by the data volume of the current service request. When a sending end prepares to send a service data packet, one TCP long connection is selected from each TCP long connection corresponding to the service data packet, and then the service data packet is sent through the selected TCP long connection. Such as: the service request to be sent currently corresponds to IP ports 1 and 2 in the receiving end 1 and IP port 4 in the receiving end 2, one of the IP ports 1 and 4 is selected, and the service request is sent through the TCP long connection corresponding to the selected IP port 1, 2 or 4. Here, two receiving ends and IP ports included therein are shown by way of example only, and the application does not limit the number of receiving ends and the number of IP ports on each receiving end. By IP port is meant a port in a network device identified by an IP address and port number, simply an IP port.
The embodiment of the application provides a service data sending method which can be used for the system architecture. The method can be applied to equipment as a data transmitting end. As shown in fig. 2, the method comprises the steps of:
step 201: and establishing a TCP long connection for each IP port of the data receiving end.
In some examples, when a device that is the data sender of a service starts the service, a long TCP connection is established for each IP port on the data receiver of the service. Here, a service may have multiple receiving IP ports, and these IP ports may be located in multiple machines in the server as the receiving end, or may correspond to multiple receiving processes on the same machine.
Step 202: a first weight is configured for each TCP long connection established in step 201.
Here, the first weight may be referred to as a target transmission weight or an expected transmission weight, and is configured according to the characteristics of each IP port, and may represent an expected value or a target value of a ratio of the number of times of transmitting the traffic packet to the total number of times of transmitting the traffic packet on the TCP long connection of one IP port. Such as: a first weight of a TCP long connection may be set to 0.2, which indicates that 1/5 traffic packets are expected to be sent on the TCP long connection. For a service data packet sent by a sending end, each IP port of a receiving end of the service data packet may be distributed on multiple devices or correspond to multiple receiving processes on the same device, so that data processing capabilities and response speeds of various devices or multiple receiving processes may be different, that is, capabilities of each IP port for receiving and processing data are different, and the first weight may be configured for a long TCP connection of each IP port based on the difference. Such as: because the response speed of the local device is high, high weight can be configured for the long TCP connection of the IP port on the local device. For another example: a higher weight may be assigned to TCP long connections for IP ports on devices with stronger processing power.
Step 203: when a service data packet is sent to the data receiving end, the following processing is executed:
in some instances, when a service request for a service (such as a request to access a page in a WeChat service) is sent, the following process may be performed. In the example of the present application, the data packets transmitted through the TCP long connection are in units of service requests, that is, one service request is transmitted through one service data packet, and the data amount of each service data packet is not necessarily the same.
Step 204: a second weight for each TCP long connection is determined. Wherein the second weight of a TCP long connection is determined according to the number of times the service data packet has been sent through the TCP long connection. Here, this second weight may be referred to as an actual transmission weight of the TCP long connection, and may represent a ratio of the number of times that the traffic packet is actually transmitted on the TCP long connection of one IP port to the actual total number of times of transmission. Such as: when 10 traffic packets have been sent (i.e. 10 times), 3 packets have actually been sent (and 3 times) over the long TCP connection, the second weight of the long TCP connection is 0.3.
Step 205: and selecting one TCP long connection according to the first weight and the second weight of each TCP long connection, so that the difference between the second weight and the first weight of the selected TCP long connection is smaller.
Step 206: the service data packet is sent through the selected TCP long connection.
In some examples, the number of times each TCP long connection has been sent is counted, so that in step 206, the number of times the selected TCP long connection has been sent may be further counted, such as by adding one to the count value. Thus, in step 204, the process of determining the second weight of each TCP long connection includes: and acquiring the count value of the sent times of each TCP long connection, and respectively calculating the second weight of each TCP long connection according to the acquired count value. Such as: the second weight of a TCP long connection is the ratio of the count of its sent times to the sum of the sent times of all TCP long connections.
In some examples, in step 205, a TCP long connection with the second weight having the largest difference from the first weight or having a difference reaching a certain threshold may be selected. In this way, the second weight of each TCP long connection gradually approaches to the respective first weight, even if the number of times that each TCP long connection actually sends the service data packet approaches to the expected value or the target value set for the TCP long connection in step 202 as much as possible, thereby achieving the purpose of load balancing.
In the above example, the first weight is configured for the TCP long connection of each IP port as the receiving end, and then when sending the service data packet, one TCP long connection is selected to send the service data packet according to the current second weight of each TCP long connection and the first weight configured in advance, so that the second weight of each TCP long connection gradually approaches to the respective first weight, and each service data packet is more reasonably distributed to each TCP long connection to complete sending, thereby achieving the purpose of load balancing, being able to more reasonably utilize system resources to process the service data packet, and improving the overall performance of the system.
In some examples, an initial value of the second weight (e.g., 0) may be further configured for each TCP long connection. In step 205, when the service data packet is transmitted through the selected TCP long connection, the number of times the TCP long connection has been transmitted is counted, and the second weight of the TCP long connection is calculated according to the count value. In step 204, the determining the second weight of each TCP long connection includes: the second weight (including the second weight calculated in step 205 and/or the initial value of the configured second weight) of each TCP long connection is obtained.
In some examples, the configuring of the first weight for each TCP long connection in step 202 includes: reading the configuration file, reading each IP port and the corresponding first weight from the configuration file, and configuring the read first weight to the TCP long connection corresponding to each IP port. Here, the pre-stored configuration file may be read from a local directory, and the configuration file may be a data table or an XML file.
In some examples, the configuring of the first weight for each TCP long connection in step 202 includes: and reading each IP port and the corresponding first weight from the memory, and configuring the read first weight to the TCP long connection corresponding to each IP port. Here, the process/thread for configuring the first weight may write the information of each IP port and the corresponding first weight into a shared memory, and in step 202, the process/thread for sending the service data packet may access the shared memory to read the first weight corresponding to each IP port.
In some examples, the configuring of the first weight for each TCP long connection in step 202 includes: and acquiring a configuration file from the configuration server, reading each IP port and the corresponding first weight from the configuration file, and configuring the read first weight to the TCP long connection corresponding to each IP port. Here, the configuration file may be obtained from an external configuration server, and the configuration file may be a data table or an XML file.
In some examples, the process of selecting a long TCP connection in step 205 may include: step A: and selecting a TCP long connection corresponding to a non-suspended IP port according to the first weight and the second weight of each TCP long connection.
In some examples, the step a may be followed by: and B: and D, judging whether the selected TCP long connection is disconnected or not, if so, suspending the IP port of the TCP long connection, and executing the step A again. Here, when it is determined that the TCP long connection is disconnected, the TCP long connection may have been selected for a plurality of traffic packets, and the TCP long connection is reselected for the traffic packets.
In this example, after the TCP long connection is selected, the temporary disconnection of the TCP long connection is also considered, the corresponding IP port can be suspended in time, and an appropriate TCP long connection is selected again, thereby ensuring the successful transmission of the service data.
In some examples, the process of selecting a TCP long connection corresponding to a non-suspended IP port in step 205 may include: and randomly selecting a TCP long connection corresponding to a non-suspended IP port from the TCP long connections with the second weight smaller than the first weight. Specifically, for the TCP long connection corresponding to each non-suspended IP port, the first weight and the second weight of the TCP long connection are compared, and one TCP long connection is randomly selected from the TCP long connections whose second weight is smaller than the first weight. The selection mode can make the actual sent weight of each TCP long connection gradually approach to the target weight, so as to achieve the effect of load balancing. Moreover, the selection mode is simple to realize and high in processing speed.
In some examples, the process of selecting a TCP long connection corresponding to a non-suspended IP port in step 205 may include: calculating the difference between the first weight and the second weight of each long TCP connection corresponding to each non-suspended IP port; selecting a TCP long connection with the largest difference between the first weight and the second weight. By the selection method, the actual sent weight (second weight) of each TCP long connection can be more quickly approached to the target weight (first weight), and a better load balancing effect is achieved.
In some examples, the process of selecting a TCP long connection corresponding to a non-suspended IP port in step 205 may include:
sequentially reading information (such as port numbers, state information and the like) of all IP ports;
when an IP port is read, the following processing is performed:
if the IP port is suspended, reading the next IP port;
if the IP port is not suspended, comparing the first weight and the second weight of the IP port, and if the second weight is smaller than the first weight, selecting the TCP long connection corresponding to the IP port.
In this selection method, simply, each IP port is polled, if the second weight of an IP port is found to be smaller than the first weight, the TCP long connection corresponding to the IP port is selected, the selection process is ended, and the information of the subsequent IP port is not read. The selection mode can enable the actually sent weight of each TCP long connection to gradually approach to the target weight, and the information of all IP ports does not need to be read, judged and compared every time, so that the processing efficiency is high, and a better load balancing effect is achieved.
In some examples, the process of suspending the IP port of the TCP long connection may include: the IP port is deleted from the list of non-suspended IP ports. Further, when the preset time is reached or the TCP long connection is recovered, the IP port is added into the non-suspended IP port list. Here, a list of non-pending IP ports may be set to maintain information on non-pending IP ports, and a pending IP port may be added back to the list at a regular time after a certain IP port is deleted from the list or when TCP long connection restoration is detected.
In some examples, the process of suspending the IP port of the TCP long connection may include: in the non-suspended IP port list, the status of the IP port is set as unavailable. Further, the state of the IP port is set to be available when a predetermined time is reached or the long connection of the TCP is restored. Here, a non-suspended IP port list may be set to maintain the state of non-suspended IP ports, and the suspended IP port may be restored to the state of available after the state of a certain IP port is set to unavailable or when TCP long connection restoration is detected.
In some examples, the step a may be followed by:
step B': and B, judging whether the selected TCP long connection is disconnected or not, if so, setting the first weight of the TCP long connection as a preset value so as to reduce the probability of selecting the TCP long connection, and then executing the step A again. Here, the first weight may be set to a very low value, such as 0 or 0.01, so that the second weight of the TCP long connection may be already equal to the first weight, and the TCP long connection will not be selected in the subsequent flow. The first weight may also be set to a lower value, so that the difference between the second weight of the long TCP connection and the first weight is not large, and if the difference between the first weight and the second weight is the largest or larger when selecting the IP port, the long TCP connection will not be selected for a while. This process of resetting the value of the first weight to make the TCP long connection less likely to be selected may also be referred to as a suspend-to-IP-port approach.
Fig. 3 shows a flow chart of a service data transmission process in an example of the present application. As shown in fig. 3, the following processes are included:
step 301: and the data transmitting end reads the target weight configuration of each IP port of the data receiving end, and further configures the target weight for each IP port. As mentioned above, the target weight is the first weight, and the configuration information of the target weight may be read from a configuration file, a memory, or an external configuration server.
Step 302: the data sending end establishes TCP long connection for each IP port.
Step 303: when a data sending end prepares to send a service data packet (such as a service request), the actual sending weight of the TCP long connection of each IP port is calculated according to the count value of the sent times. As mentioned above, the actual sent weight is the second weight, and the sent times of the long TCP connections can be counted, and the sent weight can be counted by using the count value.
Step 304: and selecting a TCP long connection of a non-suspended IP port according to a pre-configured weight algorithm. The specific selection method is described above, and the weighting algorithm may be: selecting the TCP long connection of the IP port with the largest difference between the target weight and the actual sent weight, selecting the TCP long connection of the IP port with the sent weight smaller than the target weight by polling or random selection, and so on, which are not described herein again.
Step 305: determining whether the selected TCP long connection is available (i.e., determining whether to disconnect), if so, performing step 307; otherwise, step 306 is performed.
Step 306: the currently selected IP port is suspended and the process returns to step 304 to reselect the TCP long connection for one IP port. Here, the specific suspend method is described above, and is not described here again.
Step 307: the service data packet is sent through the selected TCP long connection, and a count value of the number of times of sending the TCP long connection is added with one, and then the process returns to step 303 to send the next service data packet.
In the above example, the TCP long connection can be selected based on the target weight and the actual sent weight, so as to achieve load balancing, and meanwhile, the characteristic of temporary disconnection of the TCP long connection can be compatible, thereby ensuring data transmission performance.
Based on the above example of this application, this application has still provided a device. The device can be applied to the data transmitting terminal. As shown in fig. 4, the apparatus 400 includes the following modules:
the connection establishing module 401 establishes a long TCP connection for each IP port of the data receiving end.
And a weight configuration module 402, configured with a first weight for each TCP long connection.
The data sending module 403, when sending a service data packet to the data receiving end, triggers the weight determining module 404 and the selecting module 405 to execute the following processing:
a weight determining module 404, which determines a second weight of each TCP long connection; wherein the second weight of a TCP long connection is determined according to the number of times that the service data packet has been sent through the TCP long connection.
The selecting module 405 selects a TCP long connection according to the first weight and the second weight of each TCP long connection, so that a difference between the second weight and the first weight of the selected TCP long connection becomes smaller.
The data sending module 403 sends the service data packet through the TCP long connection selected by the selecting module 405.
In some examples, the apparatus 400, further comprises: and a counting module 406, configured to count the number of times the TCP long connection has been sent when the data sending module 403 sends the service data packet through the selected TCP long connection. The weight determining module 404 obtains a count value of the sent times of each TCP long connection, and calculates the second weight of each TCP long connection according to the obtained count value.
In some examples, weight configuration module 402 further configures an initial value of the second weight for each TCP long connection. The apparatus 400 further comprises: the calculating module 407, when the data sending module 403 sends the service data packet through the selected TCP long connection, counts the sent times of the TCP long connection, and calculates the second weight of the TCP long connection according to the count value. Wherein, the weight determining module 404 obtains the second weight of each TCP long connection calculated by the technique module 407.
In some examples, the selecting module 405 selects a TCP long connection corresponding to a non-suspended IP port according to the first weight and the second weight of each TCP long connection.
In some examples, the selecting module 405 further determines whether the selected TCP long connection is disconnected after selecting the TCP long connection corresponding to one of the non-suspended IP ports, and if the selected TCP long connection is disconnected, suspends the IP port of the TCP long connection, and re-executes the processing of selecting the TCP long connection corresponding to the one of the non-suspended IP ports.
In some examples, the selecting module 405 further determines whether the selected TCP long connection is disconnected after selecting the TCP long connection corresponding to one non-suspended IP port, and if the selected TCP long connection is disconnected, sets the first weight of the TCP long connection to a predetermined value to reduce the probability of the TCP long connection being selected, and then re-executes the processing of selecting the TCP long connection corresponding to one non-suspended IP port.
The implementation principle of the functions of the above modules has been described in detail previously, and is not described in detail herein.
In an example, the service data transmitting apparatus 400 may be run in various computing devices that can be used as data transmitters, and loaded in a memory of the computing devices.
Fig. 5 is a block diagram showing a configuration of a computing device in which the service data transmission apparatus is located. As shown in fig. 5, the computing device includes one or more processors (CPUs) 502, a communication module 504, a memory 506, a user interface 510, and a communication bus 508 for interconnecting these components.
The processor 502 may receive and transmit data via the communication module 504 to enable network communications and/or local communications.
The user interface 510 includes one or more output devices 512 including one or more speakers and/or one or more visual displays. The user interface 510 also includes one or more input devices 514, including, for example, a keyboard, a mouse, a voice command input unit or microphone, a touch screen display, a touch sensitive tablet, a gesture capture camera or other input buttons or controls, and the like.
The memory 506 may be a high-speed random access memory such as DRAM, SRAM, DDR RAM, or other random access solid state memory devices; or non-volatile memory, such as one or more magnetic disk storage devices, optical disk storage devices, flash memory devices, or other non-volatile solid-state storage devices.
The memory 506 stores a set of instructions executable by the processor 502, including:
an operating system 516, including programs for handling various basic system services and for performing hardware related tasks;
the applications 518 include various applications for transmitting business data, which can implement the process flow in the above examples, such as may include the apparatus 400 shown in fig. 4. In some examples, the apparatus 400 may include some or all of the modules 401-407 shown in FIG. 4, and each of the modules 401-407 may store machine-executable instructions. The processor 502 can implement the functions of the modules 401 to 407 by executing the machine-executable instructions in the modules 401 to 407 in the memory 506.
It should be noted that not all steps and modules in the above flows and structures are necessary, and some steps or modules may be omitted according to actual needs. The execution order of the steps is not fixed and can be adjusted as required. The division of each module is only for convenience of describing adopted functional division, and in actual implementation, one module may be divided into multiple modules, and the functions of multiple modules may also be implemented by the same module, and these modules may be located in the same device or in different devices.
The hardware modules in the embodiments may be implemented in hardware or a hardware platform plus software. The software includes machine-readable instructions stored on a non-volatile storage medium. Thus, embodiments may also be embodied as software products.
In various examples, the hardware may be implemented by specialized hardware or hardware executing machine-readable instructions. For example, the hardware may be specially designed permanent circuits or logic devices (e.g., special purpose processors, such as FPGAs or ASICs) for performing the specified operations. Hardware may also include programmable logic devices or circuits temporarily configured by software (e.g., including a general purpose processor or other programmable processor) to perform certain operations.
In addition, each example of the present application can be realized by a data processing program executed by a data processing apparatus such as a computer. It is clear that a data processing program constitutes the present application. Further, the data processing program, which is generally stored in one storage medium, is executed by directly reading the program out of the storage medium or by installing or copying the program into a storage device (such as a hard disk and/or a memory) of the data processing device. Such a storage medium therefore also constitutes the present application, which also provides a non-volatile storage medium in which a data processing program is stored, which data processing program can be used to carry out any one of the above-mentioned method examples of the present application.
The machine-readable instructions corresponding to the modules in fig. 5 may cause an operating system or the like operating on the computer to perform some or all of the operations described herein. The nonvolatile computer-readable storage medium may be a memory provided in an expansion board inserted into the computer or written to a memory provided in an expansion unit connected to the computer. A CPU or the like mounted on the expansion board or the expansion unit may perform part or all of the actual operations according to the instructions.
The nonvolatile computer readable storage medium includes a floppy disk, a hard disk, a magneto-optical disk, an optical disk (e.g., CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD + RW), a magnetic tape, a nonvolatile memory card, and a ROM. Alternatively, the program code may be downloaded from a server computer via a communications network.
In view of the above, the scope of the claims should not be limited to the embodiments in the examples described above, but should be given the broadest interpretation given the description as a whole.
Claims (15)
1. A method for transmitting service data, the method comprising:
establishing a Transmission Control Protocol (TCP) long connection for each IP port of a data receiving end;
aiming at each IP port, configuring a first weight for the TCP long connection of the IP port according to the data processing capacity and the response speed of the equipment or the receiving process corresponding to the IP port; and
when a service data packet is sent to the data receiving end, the following processing is executed:
for each TCP long connection, determining a second weight of the TCP long connection according to the number of times that a service data packet has been sent through the TCP long connection;
selecting the TCP long connection with the largest difference between the second weight and the first weight according to the first weight and the second weight of each TCP long connection; and
and transmitting the service data packet through the selected TCP long connection.
2. The method of claim 1, further comprising:
when the service data packet is transmitted through the selected TCP long connection, counting the number of times of transmitting the service data packet of the TCP long connection;
wherein the determining the second weight of the TCP long connection according to the number of times the service data packet has been sent through the TCP long connection includes:
obtaining the counting value of the TCP long connection; and
and calculating the second weight of the TCP long connection according to the counting value.
3. The method of claim 1, further comprising:
configuring an initial value of the second weight for each TCP long connection; and
when the service data packet is sent through the selected TCP long connection, counting the number of times of sending the service data packet of the TCP long connection, and calculating the second weight of the TCP long connection according to the count value.
4. The method according to claim 1, wherein said selecting the TCP long connection with the largest difference between the second weight and the first weight according to the first weight and the second weight of each TCP long connection comprises:
A. and selecting a long TCP connection corresponding to a non-suspended IP port.
5. The method of claim 4, wherein step A is further followed by:
B. and D, judging whether the selected TCP long connection is disconnected or not, if so, suspending the IP port of the TCP long connection, and executing the step A again.
6. The method of claim 1, wherein each IP port is distributed across multiple devices or corresponds to multiple receiving processes on the same device.
7. The method of claim 4, wherein the selecting a long TCP connection corresponding to a non-suspended IP port comprises:
calculating the difference between the first weight and the second weight of each long TCP connection corresponding to each non-suspended IP port; and
selecting one TCP long connection with the largest difference between the first weight and the second weight.
8. The method of claim 4, wherein the selecting a long TCP connection corresponding to a non-suspended IP port comprises:
sequentially reading the information of each IP port;
when reading the information of an IP port, executing the following processing:
if the IP port is suspended, reading the information of the next IP port;
if the IP port is not suspended, comparing the first weight and the second weight of the IP port, and if the difference between the second weight and the first weight is maximum, selecting the TCP long connection corresponding to the IP port.
9. The method of claim 5, wherein the suspending the IP port of the TCP long connection comprises: deleting the IP port from the non-suspended IP port list;
the method further comprises the following steps: and when a preset time is up or the recovery of the long connection of the TCP is detected, adding the IP port into the non-suspended IP port list.
10. The method of claim 5, wherein the suspending the IP port of the TCP long connection comprises: setting the state of the IP port as unavailable in a non-suspended IP port list;
the method further comprises the following steps: and setting the state of the IP port to be available when a preset time is up or the recovery of the TCP long connection is detected.
11. The method of claim 4, wherein step A is further followed by:
B. and B, judging whether the selected TCP long connection is disconnected, if so, setting the first weight of the TCP long connection as a preset value to reduce the probability of selecting the TCP long connection, and then executing the step A again.
12. A traffic data transmitting apparatus, comprising:
the connection establishing module is used for establishing a Transmission Control Protocol (TCP) long connection for each IP port of the data receiving end;
the weight configuration module is used for configuring a first weight for the TCP long connection of each IP port according to the data processing capacity and the response speed of the equipment or the receiving process corresponding to the IP port;
the data sending module, when sending a service data packet to the data receiving end, triggers the weight determining module and the selecting module to execute the following processing:
the weight determining module is used for determining a second weight of each TCP long connection according to the number of times of sending the service data packet through the TCP long connection;
the selection module selects the TCP long connection with the largest difference between the second weight and the first weight according to the first weight and the second weight of each TCP long connection; and
and the data sending module sends the service data packet through the TCP long connection selected by the selection module.
13. The apparatus of claim 12, wherein the means for selecting selects a TCP long connection corresponding to a non-suspended IP port.
14. A computing device comprising a memory and a processor, the memory having stored therein computer-readable instructions that, when executed by the processor, implement the method of any of claims 1 to 11.
15. A computer-readable storage medium having computer-readable instructions stored thereon which, when executed by at least one processor, implement the method of any one of claims 1 to 11.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611052698.7A CN108111431B (en) | 2016-11-24 | 2016-11-24 | Service data sending method, device, computing equipment and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611052698.7A CN108111431B (en) | 2016-11-24 | 2016-11-24 | Service data sending method, device, computing equipment and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108111431A CN108111431A (en) | 2018-06-01 |
CN108111431B true CN108111431B (en) | 2021-09-24 |
Family
ID=62205020
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611052698.7A Active CN108111431B (en) | 2016-11-24 | 2016-11-24 | Service data sending method, device, computing equipment and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108111431B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111835850B (en) * | 2020-07-13 | 2021-01-26 | 四川虹魔方网络科技有限公司 | ADX advertisement platform |
CN114567416B (en) * | 2022-04-06 | 2024-06-07 | 西安羚控电子科技有限公司 | TCP-based data transmission verification-free method and system |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101729589A (en) * | 2008-10-14 | 2010-06-09 | 北京大学 | Method and system for improving end-to-end data transmission rate |
CN102316133A (en) * | 2010-07-01 | 2012-01-11 | 中国移动通信集团上海有限公司 | Method and device for balancing load |
CN102387071A (en) * | 2011-10-12 | 2012-03-21 | 苏州阔地网络科技有限公司 | Network load balancing method, processor and system |
CN104270472A (en) * | 2014-10-24 | 2015-01-07 | 杭州高达软件系统股份有限公司 | Remote service invocation method, device and system |
CN105100152A (en) * | 2014-05-14 | 2015-11-25 | 腾讯科技(深圳)有限公司 | Application server selection method and system, and application client |
CN105282259A (en) * | 2015-11-13 | 2016-01-27 | 深圳联友科技有限公司 | Load balancing allocation method, agent and system used for background cluster service |
CN105677451A (en) * | 2014-11-18 | 2016-06-15 | 北京风行在线技术有限公司 | Load balancing method and equipment used for multiple processes |
US9455956B2 (en) * | 2011-02-16 | 2016-09-27 | Fortinet, Inc. | Load balancing in a network with session information |
CN105991708A (en) * | 2015-02-10 | 2016-10-05 | 腾讯科技(深圳)有限公司 | Selection method of application server, apparatus and system thereof |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102932268A (en) * | 2012-11-05 | 2013-02-13 | 杭州迪普科技有限公司 | Data packet transmitting method and device |
CN103117946B (en) * | 2012-12-11 | 2016-06-08 | 广东电网公司电力调度控制中心 | Traffic sharing method based on isolating device with isolation gateway connected applications |
CN103024081B (en) * | 2013-01-04 | 2016-01-20 | 福建星网锐捷通讯股份有限公司 | Be applicable to the terminal scheduling method of the point-to-point communication of effective guarantee communication system |
CN103152284B (en) * | 2013-03-18 | 2016-06-01 | 神州数码网络(北京)有限公司 | A kind of router multipath exports method and the router of intelligent load equilibrium |
WO2015001394A1 (en) * | 2013-07-05 | 2015-01-08 | Pismo Labs Technology Ltd. | Methods and systems for transmitting packets through aggregated end-to-end connection |
US9900253B2 (en) * | 2014-08-28 | 2018-02-20 | Cavium, Inc. | Phantom queue link level load balancing system, method and device |
-
2016
- 2016-11-24 CN CN201611052698.7A patent/CN108111431B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101729589A (en) * | 2008-10-14 | 2010-06-09 | 北京大学 | Method and system for improving end-to-end data transmission rate |
CN102316133A (en) * | 2010-07-01 | 2012-01-11 | 中国移动通信集团上海有限公司 | Method and device for balancing load |
US9455956B2 (en) * | 2011-02-16 | 2016-09-27 | Fortinet, Inc. | Load balancing in a network with session information |
CN102387071A (en) * | 2011-10-12 | 2012-03-21 | 苏州阔地网络科技有限公司 | Network load balancing method, processor and system |
CN105100152A (en) * | 2014-05-14 | 2015-11-25 | 腾讯科技(深圳)有限公司 | Application server selection method and system, and application client |
CN104270472A (en) * | 2014-10-24 | 2015-01-07 | 杭州高达软件系统股份有限公司 | Remote service invocation method, device and system |
CN105677451A (en) * | 2014-11-18 | 2016-06-15 | 北京风行在线技术有限公司 | Load balancing method and equipment used for multiple processes |
CN105991708A (en) * | 2015-02-10 | 2016-10-05 | 腾讯科技(深圳)有限公司 | Selection method of application server, apparatus and system thereof |
CN105282259A (en) * | 2015-11-13 | 2016-01-27 | 深圳联友科技有限公司 | Load balancing allocation method, agent and system used for background cluster service |
Also Published As
Publication number | Publication date |
---|---|
CN108111431A (en) | 2018-06-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115004673B (en) | Message pushing method, device, electronic equipment and computer readable medium | |
CN111163130B (en) | Network service system and data transmission method thereof | |
CN101815033A (en) | Method, device and system for load balancing | |
CN108337699B (en) | Internet surfing method and device, mobile terminal and storage medium | |
CN103781055A (en) | Data downloading method and associated device | |
EP2547168B1 (en) | Android system with simulataneous support of multiple pdp contexts | |
CN110650209B (en) | Method and device for realizing load balancing | |
US20180295062A1 (en) | System and method for efficient traffic shaping and quota enforcement in a cluster environment | |
CN102137104B (en) | Transmission control protocol (TCP) long-connection access control method and device | |
CN108111431B (en) | Service data sending method, device, computing equipment and computer readable storage medium | |
CN111580882B (en) | Application program starting method, device, computer system and medium | |
CN107579929B (en) | Method, system and related device for setting reliable connection communication queue pair | |
CN105430028B (en) | Service calling method, providing method and node | |
CN104753825B (en) | The delivery method and system of login status when instant messaging multiple terminals logs in | |
CN110515728A (en) | Server scheduling method, apparatus, electronic equipment and machine readable storage medium | |
CN107682389A (en) | A kind of method, terminal and computer-readable recording medium for performing network request | |
CN109479214B (en) | Load balancing method and related device | |
CN105763456A (en) | Path selection method, device and system | |
CN112860431A (en) | Connection method, system, equipment and storage medium of micro service node | |
US9647966B2 (en) | Device, method and non-transitory computer readable storage medium for performing instant message communication | |
CN111416851A (en) | Method for session synchronization among multiple load balancers and load balancer | |
CN112714420B (en) | Network access method and device of wifi hotspot providing equipment and electronic equipment | |
CN110535959A (en) | A kind of method, apparatus and computer readable storage medium for transmitting data | |
CN113946376B (en) | Load adjustment method and device, electronic equipment and storage medium | |
CN110933122A (en) | Method, apparatus, and computer storage medium for managing server |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TG01 | Patent term adjustment |