WO2018036406A1 - 消息传输系统、方法和装置 - Google Patents
消息传输系统、方法和装置 Download PDFInfo
- Publication number
- WO2018036406A1 WO2018036406A1 PCT/CN2017/097492 CN2017097492W WO2018036406A1 WO 2018036406 A1 WO2018036406 A1 WO 2018036406A1 CN 2017097492 W CN2017097492 W CN 2017097492W WO 2018036406 A1 WO2018036406 A1 WO 2018036406A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- unit
- message
- thread
- time period
- encapsulation
- 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.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/548—Queue
Definitions
- the present application relates to computer technology, and in particular, to a message transmission system, method and apparatus.
- a process unit can contain one or more thread units, and a large number of message transmissions are involved between the process units and between the thread units within the process unit.
- a message generated by a thread unit in the same process unit is usually sent to a sending queue of the process unit, and the process unit encapsulates the fixed size according to the process (the scale refers to the process encapsulation).
- the number of messages included in the packet is a packet processing process for the message in the sending queue, and the process encapsulation packet generated by the encapsulation process is transmitted from one process unit to another through the network channel, and the process encapsulation packet is received.
- the process unit performs corresponding message decapsulation processing, and sends the message obtained after the decapsulation process to the corresponding thread unit.
- the process unit A includes a thread unit A1, a thread unit A2, and a thread unit A3.
- the process unit B includes a thread unit B1, a thread unit B2, and a thread unit B3.
- the thread unit of the process unit A and the thread unit of the process unit B exist.
- Message transmission the message generated by the thread unit A1, the thread unit A2 and the thread unit A3 is sent to the sending queue of the process unit A, and the message in the sending queue of the process unit A is encapsulated according to the fixed scale of the process encapsulation packet.
- the encapsulated packet generated by the encapsulation process is sent to the process unit B through the network channel between the process unit A and the process unit B, and the process unit B receives the process encapsulation packet and performs corresponding message decapsulation processing, and obtains the decapsulation process.
- the message is sent to the corresponding thread unit.
- the present application provides a message transmission system, method, and apparatus to solve the problem of low utilization of network resources in the prior art.
- the application provides a message transmission system, including:
- the source process unit including at least one thread unit, the source process a unit and the destination process unit are connected;
- the source process unit is configured to determine, according to the first historical time period, the frequency of the message unit sent by the at least one thread unit to the sending queue of the source process unit, to determine that the first current time period of the source process unit corresponds to
- the process encapsulates the size of the packet, and the message unit includes at least one message;
- the source process unit is further configured to perform encapsulation processing on the message unit in the sending queue of the source process unit according to the size of the process encapsulation packet corresponding to the first current time period, to generate a process encapsulation packet;
- the source process unit is further configured to send the process encapsulation packet to the destination process unit.
- the source process unit is specifically configured to: if the number of message units in the sending queue of the source process unit is the same process unit, the number of message units is greater than or equal to the process encapsulation corresponding to the first current time period.
- the size of the packet is encapsulated by the message unit of the same process unit according to the size of the process encapsulation packet corresponding to the first current time period, and the first process encapsulation packet is generated, where the The number of message units included in a process encapsulation packet is the same as the size of the process encapsulation packet corresponding to the first current time period.
- the source process unit is further configured to: if the number of message units in the sending queue of the source process unit is the same process unit, the number of message units is less than the process encapsulation corresponding to the first current time period. Determining, by the size of the packet, whether the first waiting time of the message unit that is the earliest entering the sending queue in the message unit of the same process unit is greater than or equal to the first preset timing time, if the first waiting time If the first preset timing is greater than or equal to the first preset timing, the message unit of the same process unit is encapsulated to generate a second process encapsulation packet, where the second process encapsulation packet includes the sending queue.
- the destination process unit is all message units of the same process unit.
- the source process unit is specifically configured to acquire, by using the first process encapsulation packet and the second process encapsulation packet, a first quantity of message units in the first historical time period; And acquiring, in the first historical time period, a second quantity of message units sent by the second process encapsulation packet; according to the second quantity and the first quantity ratio and the first historical time
- the size of the process encapsulation packet corresponding to the segment determines the size of the process encapsulation packet corresponding to the first current time segment.
- the application provides a message transmission method, including:
- the message The unit contains at least one message
- the message unit in the middle performs encapsulation processing to generate a process encapsulation package
- the process encapsulation package includes: a first process encapsulation package
- the process encapsulation packet is encapsulated by the message unit of the same process unit, and the first process encapsulation packet is generated, where the number of message units included in the first process encapsulation packet is the same as the number
- the process encapsulation packets corresponding to a current time period have the same scale.
- the process encapsulation package further includes: a second process encapsulation package;
- the method further includes:
- the process unit performs encapsulation processing on the message unit of the same process unit to generate a second process encapsulation packet, where the second process encapsulation packet includes all message units in the sending queue whose destination process unit is the same process unit.
- the thread unit that sends the message unit to the sending queue of the source process unit according to the thread unit of the source process unit in the first historical time period determines the first current time period of the source process unit.
- the scale of the process package including:
- the determining, according to the ratio of the second quantity and the first quantity, and the size of a process encapsulation packet corresponding to the first historical time period, determining a process corresponding to the first current time period includes:
- the degree is a product of a scale of the process encapsulation packet corresponding to the first historical time period and a first coefficient, wherein the first coefficient is less than 1.
- the ratio is less than or equal to the first preset threshold, determining that the size of the process encapsulation packet corresponding to the first current time period is the size of the process encapsulation packet corresponding to the first historical time period and the second coefficient a product, wherein the second coefficient is greater than one.
- the ratio of the first quantity to the third quantity is the second coefficient, wherein the third quantity is a previous time period of the first historical time period, and the package is encapsulated by the first process The number of message units sent by the second process encapsulation packet.
- the first preset threshold is 0.5.
- the application provides a message transmission apparatus, including:
- a processing module configured to determine, according to a frequency of the message unit sent by the thread unit of the source process unit to the sending queue of the source process unit, the process encapsulation packet corresponding to the first current time period of the source process unit a scale, the message unit includes at least one message;
- the encapsulating module is configured to perform encapsulation processing on the message unit in the sending queue of the source process unit according to the size of the process encapsulation packet corresponding to the first current time period, to generate a process encapsulation packet;
- a sending module configured to send the process encapsulation package.
- the process encapsulation package includes: a first process encapsulation package
- the encapsulating module is specifically configured to: if the number of the message units in the sending process queue of the source process unit that are the same process unit in the sending process queue is greater than or equal to the size of the process encapsulating packet corresponding to the first current time segment, The size of the process encapsulation packet corresponding to the first current time period, the message unit of the same process unit is encapsulated, and the first process encapsulation packet is generated, where the message encapsulated in the first process encapsulation packet is included The number of units is the same as the size of the process encapsulation packet corresponding to the first current time period.
- the process encapsulation package further includes: a second process encapsulation package;
- the encapsulating module is further configured to: if the number of the message units in the sending queue of the source process unit that are the same process unit in the sending queue of the source process unit is smaller than the size of the process encapsulation packet corresponding to the first current time segment, determine the If the target process unit is the first waiting time of the message unit of the same process unit that is the first to enter the sending queue, the first waiting time is greater than or equal to the first preset time, if the first waiting time is greater than or equal to the first preset Timing time, the message unit of the same process unit is encapsulated and processed, and the second process is generated. And encapsulating the packet, where the second process encapsulation packet includes all message units in the sending queue that are the same process unit in the destination process unit.
- the processing module is specifically configured to be used
- the processing module is specifically configured to: if the ratio is greater than the first preset threshold, determine that the size of the process encapsulation packet corresponding to the first current time period is the first historical time period.
- the scale of the process encapsulation packet is the product of the first coefficient, wherein the first coefficient is less than one.
- the processing module is further configured to: if the ratio is less than or equal to the first preset threshold, determine that the size of the process encapsulation packet corresponding to the first current time period is the first The product of the process encapsulation packet corresponding to the historical time period and the product of the second coefficient, wherein the second coefficient is greater than 1.
- the processing module is further configured to determine that the ratio of the first quantity to the third quantity is the second coefficient, where the third quantity is before the first historical time period The number of message units transmitted by the first process encapsulation packet and the second process encapsulation packet for a period of time.
- the first preset threshold is 0.5.
- the application provides a message transmission apparatus, including:
- a processor configured to determine, according to a frequency of a message unit sent by a thread unit of the source process unit, to a sending queue of the source process unit, to determine a process encapsulation packet corresponding to the first current time period of the source process unit.
- the message unit includes at least one message;
- the processor is further configured to perform encapsulation processing on the message unit in the sending queue of the source process unit according to the size of the process encapsulation packet corresponding to the first current time period, to generate a process encapsulation packet;
- a transmitter coupled to the processor, the transmitter for transmitting the process encapsulation packet.
- the process encapsulation package includes: a first process encapsulation package
- the processor is specifically configured to: if the number of the message unit of the same process unit in the sending queue of the source process unit is greater than or equal to the size of the process encapsulation packet corresponding to the first current time segment, The size of the process encapsulation packet corresponding to the first current time period, the message unit of the same process unit is encapsulated, and the first process encapsulation packet is generated, where the message encapsulated in the first process encapsulation packet is included The number of units is the same as the size of the process encapsulation packet corresponding to the first current time period.
- the process encapsulation package further includes: a second process encapsulation package;
- the processor is further configured to: if the number of the message units in the sending queue of the source process unit that are the same process unit in the sending queue of the source process unit is smaller than the size of the process encapsulation packet corresponding to the first current time period, determine the If the target process unit is the first waiting time of the message unit of the same process unit that is the first to enter the sending queue, the first waiting time is greater than or equal to the first preset time, if the first waiting time is greater than or equal to the first preset At the time of the process, the message unit of the same process unit is encapsulated to generate a second process encapsulation packet, where the second process encapsulation packet includes the destination process unit in the transmit queue as the same process unit. All message units.
- the processor is specifically used to perform
- the processor is specifically configured to: if the ratio is greater than the first preset threshold, determine that the size of the process encapsulation packet corresponding to the first current time period is the first historical time period.
- the scale of the process encapsulation packet is the product of the first coefficient, wherein the first coefficient is less than one.
- the processor is further configured to: if the ratio is less than or equal to the first preset threshold, determine that the size of the process encapsulation packet corresponding to the first current time period is the first The product of the process encapsulation packet corresponding to the historical time period and the product of the second coefficient, wherein the second coefficient is greater than 1.
- the processor is further configured to determine that the ratio of the first quantity to the third quantity is the second coefficient, where the third quantity is before the first historical time period The number of message units transmitted by the first process encapsulation packet and the second process encapsulation packet for a period of time.
- the first preset threshold is 0.5.
- the application provides a message transmission system, including:
- the source process unit including at least one thread unit
- the thread unit is configured to perform encapsulation processing on a message generated by the thread unit to generate a message unit, where the message unit includes at least two messages;
- the thread unit is further configured to send the message unit to a sending queue of the source process unit.
- the thread unit is specifically configured to perform encapsulation processing on a message generated by the thread unit according to a scale of a thread encapsulation packet corresponding to the second current time period, to generate the message unit;
- the threading unit is further configured to determine a size of a thread encapsulation package corresponding to the second current time period according to the number of messages generated by the thread unit in the second historical time period.
- the thread unit is specifically configured to: if the number of messages of the target thread unit generated by the thread unit being the same thread unit is greater than or equal to the size of the thread encapsulation package corresponding to the second current time period, Encapsulating the message of the same thread unit by the destination thread unit according to the scale of the thread encapsulation package, and generating a first message unit, where the number of messages included in the first message unit is related to the thread encapsulation The scale of the package is the same.
- the thread unit is further configured to: if the number of messages of the target thread unit generated by the thread unit being the same thread unit is smaller than the size of the thread package package corresponding to the second current time period, Determining whether the second waiting time of the earliest generated message in the message of the same thread unit is greater than or equal to the second preset timing time, and if the second waiting time is greater than or equal to the second preset timing time, Then, the message that the destination thread unit is the same thread unit is encapsulated to generate a second message unit, wherein the second message unit includes all messages in which the destination thread unit generated by the thread unit is the same thread unit.
- the thread unit is specifically configured to acquire a third quantity of messages sent by the first message unit and the second message unit in the second historical time period; and a fourth number of messages sent by the second message unit in the second historical time period; a thread encapsulation packet corresponding to the fourth quantity and the third quantity ratio and the second historical time period The scale of the thread encapsulation package corresponding to the second current time period is determined.
- the application provides a message transmission method, including:
- the encapsulating the message generated by the thread unit includes:
- the message generated by the thread unit is encapsulated according to the size of the thread encapsulation packet corresponding to the second current time period, and the message unit is generated.
- the message generated by the thread unit is encapsulated according to the size of the thread encapsulation packet corresponding to the second current time period.
- the method further includes:
- the message unit includes a first message unit
- the target thread is processed according to the scale of the thread encapsulation package.
- the unit performs encapsulation processing on the message of the same thread unit to generate a first message unit, where the number of messages included in the first message unit is the same as the size of the thread encapsulation package.
- the message unit further includes a second message unit
- the method further includes:
- the destination thread unit is the earliest message in the same thread unit If the second waiting time of the message is greater than or equal to the second preset timing time, if the second waiting time is greater than or equal to the second preset timing time, the message of the same thread unit is encapsulated by the destination thread unit. Processing, generating a second message unit, wherein the second message unit includes all messages in which the destination thread unit generated by the thread unit is the same thread unit.
- the determining, according to the number of messages generated by the thread unit in the second historical time period, the size of the thread encapsulation package corresponding to the second current time period including:
- the determining, according to the ratio of the fourth quantity and the third quantity, and the size of the thread encapsulation package corresponding to the second historical time period, determining a thread corresponding to the second current time period includes:
- the ratio is greater than the second preset threshold, determining that the size of the thread encapsulation packet corresponding to the second current time period is the product of the size of the thread encapsulation packet corresponding to the second historical time period and the third coefficient, where The third coefficient is less than one.
- the ratio is less than or equal to the second preset threshold, determining that the size of the thread encapsulation packet corresponding to the second current time period is the size of the thread encapsulation packet corresponding to the second historical time period and the fourth coefficient Product, among them, The fourth coefficient is greater than one.
- the second preset threshold is 0.5.
- the message generated by the thread unit is encapsulated according to the size of the thread encapsulation packet corresponding to the second current time period.
- the method further includes:
- the destination thread unit that determines the message generated by the thread unit does not belong to the source process unit.
- the application provides a message transmission apparatus, including:
- An encapsulating module configured to perform encapsulation processing on a message generated by a thread unit, to generate a message unit, where the message unit includes at least two messages;
- a sending module configured to send the message unit to a sending queue of the source process unit.
- the encapsulating module is specifically configured to perform encapsulation processing on a message generated by the thread unit according to a scale of the thread encapsulation packet corresponding to the second current time period, to generate the message unit.
- a processing module configured to determine, according to the number of messages generated by the thread unit in the second historical time period, a size of the thread encapsulation package corresponding to the second current time period.
- the message unit includes a first message unit
- the encapsulation module is specifically configured to: if the number of the message that the destination thread unit is the same thread unit generated by the thread unit is greater than or equal to the size of the thread encapsulation packet corresponding to the second current time period, And the first message unit is generated by the first thread unit, wherein the number of messages included in the first message unit is the same as the size of the thread package.
- the message unit further includes a second message unit
- the encapsulating module is further configured to: if the number of the message that the destination thread unit is the same thread unit generated by the thread unit is smaller than the size of the thread encapsulation packet corresponding to the second current time period, determine that the target thread unit is Whether the second waiting time of the first generated message in the message of the same thread unit is greater than or equal to the second preset timing time, and if the second waiting time is greater than or equal to the second preset timing time, the target thread unit is Encapsulating the message of the same thread unit to generate a second message unit, wherein the second message unit includes all messages in which the destination thread unit generated by the thread unit is the same thread unit.
- the processing module is specifically configured to acquire a third quantity of messages sent by the first message unit and the second message unit in the second historical time period; and a fourth number of messages sent by the second message unit in the second historical time period; a thread encapsulation packet corresponding to the fourth quantity and the third quantity ratio and the second historical time period a measure of the second current time The scale of the thread encapsulation package corresponding to the interval.
- the processing module is specifically configured to: if the ratio is greater than the second preset threshold, determine that the size of the thread encapsulation packet corresponding to the second current time period is the second historical time period.
- the scale of the thread encapsulation packet is a product of a third coefficient, wherein the third coefficient is less than one.
- the processing module is further configured to: if the ratio is less than or equal to the second preset threshold, determine that the size of the thread encapsulation packet corresponding to the second current time period is the second The product of the thread encapsulation packet corresponding to the historical time period and the fourth coefficient, wherein the fourth coefficient is greater than 1.
- the second preset threshold is 0.5.
- the processing module is further configured to determine that the destination thread unit of the message generated by the thread unit does not belong to the source process unit.
- the application provides a message transmission apparatus, including:
- a processor configured to perform encapsulation processing on a message generated by the thread unit, to generate a message unit, where the message unit includes at least two messages;
- a transmitter coupled to the processor, the transmitter for transmitting the message unit to a transmit queue of the source process unit.
- the processor is specifically configured to perform encapsulation processing on the message generated by the thread unit according to the size of the thread encapsulation packet corresponding to the second current time period, to generate the message unit.
- the processor is further configured to determine, according to the number of messages generated by the thread unit in the second historical time period, a size of a thread encapsulation package corresponding to the second current time period.
- the message unit includes a first message unit
- the processor is specifically configured to: if the number of the message that the destination thread unit is the same thread unit generated by the thread unit is greater than or equal to the size of the thread encapsulation packet corresponding to the second current time period, And the first message unit is generated by the first thread unit, wherein the number of messages included in the first message unit is the same as the size of the thread package.
- the message unit further includes a second message unit
- the processor is further configured to: if the number of the message that the destination thread unit is the same thread unit generated by the thread unit is smaller than the size of the thread encapsulation packet corresponding to the second current time period, determine that the destination thread unit is Whether the second waiting time of the first generated message in the message of the same thread unit is greater than or equal to the second preset timing time, and if the second waiting time is greater than or equal to the second preset timing time, the target thread unit is Encapsulating a message of the same thread unit to generate a second message unit, where the second message unit includes The destination thread unit generated by the thread unit is all messages of the same thread unit.
- the processor is specifically configured to acquire a third quantity of messages sent by the first message unit and the second message unit in the second historical time period; and a fourth number of messages sent by the second message unit in the second historical time period; a thread encapsulation packet corresponding to the fourth quantity and the third quantity ratio and the second historical time period The scale of the thread encapsulation package corresponding to the second current time period is determined.
- the processor is specifically configured to: if the ratio is greater than the second preset threshold, determine that the size of the thread encapsulation packet corresponding to the second current time period is the second historical time period.
- the scale of the thread encapsulation packet is a product of a third coefficient, wherein the third coefficient is less than one.
- the processor is further configured to: if the ratio is less than or equal to the second preset threshold, determine that the size of the thread encapsulation packet corresponding to the second current time period is the second The product of the thread encapsulation packet corresponding to the historical time period and the fourth coefficient, wherein the fourth coefficient is greater than 1.
- the second preset threshold is 0.5.
- the processor is further configured to determine that the destination thread unit of the message generated by the thread unit does not belong to the source process unit.
- the application provides a message transmission system, including:
- process unit including a source thread unit and a destination thread unit;
- the source thread unit is configured to determine whether a destination thread unit of the message generated by the source thread unit belongs to the same process unit;
- the source thread unit is further configured to: if the destination thread unit of the message belongs to the same process unit, send the message to a receive queue of the destination thread unit.
- the application provides a message transmission method, including:
- the message is sent to the receive queue of the destination thread unit.
- the application provides a message transmission apparatus, including:
- a processing module configured to determine whether a destination thread unit of the generated message belongs to the same process unit as the source thread unit;
- a sending module configured to send the message to a receiving queue of the destination thread unit if the destination thread unit of the message belongs to the same process unit as the source thread unit.
- the application provides a message transmission apparatus, including:
- processors configured to determine whether a destination thread unit of the generated message belongs to the same process unit as the source thread unit;
- the transmitter is coupled to the processor, and the transmitter is configured to send the message to a receive queue of the destination thread unit if the destination thread unit of the message belongs to the same process unit as the source thread unit.
- the message transmission system, method and device provided by the present application determine the first current time period of the source process unit by transmitting the frequency of the message unit to the sending queue of the source process unit according to the thread unit of the source process unit in the first historical time period.
- the size of the process encapsulation packet encapsulates the message unit in the sending queue of the source process unit according to the scale of the process encapsulation packet corresponding to the first current time period, generates a process encapsulation packet, and sends a process encapsulation packet to implement message transmission and improve Utilization of network resources and improvement of transmission efficiency.
- FIG. 1 is a schematic diagram of an application scenario of the present application
- Embodiment 1 of a message transmission system according to the present application
- Embodiment 3 is a schematic flowchart of Embodiment 1 of a message transmission method according to the present application.
- Embodiment 4 is a schematic flowchart of Embodiment 2 of a message transmission method according to the present application.
- FIG. 5 is a schematic flowchart of Embodiment 3 of a message transmission method according to the present application.
- Embodiment 1 of a message transmission apparatus according to the present application.
- FIG. 7 is a schematic structural diagram of Embodiment 2 of a message transmission apparatus according to the present application.
- Embodiment 8 is a schematic structural diagram of Embodiment 2 of a message transmission system according to the present application.
- Embodiment 9 is a schematic flowchart of Embodiment 4 of a message transmission method according to the present application.
- Embodiment 5 is a schematic flowchart of Embodiment 5 of a message transmission method according to the present application.
- FIG. 11 is a schematic flowchart of Embodiment 6 of a message transmission method according to the present application.
- FIG. 12 is a schematic flowchart of Embodiment 7 of a message transmission method according to the present application.
- FIG. 13 is a schematic structural diagram of Embodiment 3 of a message transmission apparatus according to the present application.
- Embodiment 4 of a message transmission apparatus according to the present application.
- Embodiment 15 is a schematic structural diagram of Embodiment 3 of a message transmission system according to the present application.
- Embodiment 8 is a schematic flowchart of Embodiment 8 of a message transmission method according to the present application.
- FIG. 17 is a schematic structural diagram of Embodiment 5 of a message transmission apparatus according to the present application.
- FIG. 18 is a schematic structural diagram of Embodiment 6 of a message transmission apparatus according to the present application.
- first, second, third, etc. may be used to describe XXX in embodiments of the invention, these XXX should not be limited to these terms. These terms are only used to distinguish XXX from each other.
- first XXX may also be referred to as a second XXX without departing from the scope of the embodiments of the present invention.
- second XXX may also be referred to as a first XXX.
- the words “if” and “if” as used herein may be interpreted to mean “when” or “when” or “in response to determining” or “in response to detecting.”
- the phrase “like If determined or “if detected (condition or event stated)” can be interpreted as “when determined” or “in response to determination” or “when detected (condition or event stated)” or “in response to detection (statement) Condition or event)”.
- FIG. 1 is the present application.
- a schematic diagram of an application scenario where the application scenario includes a process unit A and a process unit B, where the process unit A includes a thread unit A1, a thread unit A2, and a thread unit A3, and the process unit B includes a thread unit B1, a thread unit B2, and Thread unit B3, message transmission can be performed between each thread unit, for example, one case is: message transmission between thread unit A1 of process unit A and thread unit B2 of process unit B, and another case is process unit A Message transfer between thread unit A1 and thread unit A2 of process unit A.
- the message unit described in the present application may include a message or a plurality of messages, depending on whether the thread unit encapsulates the message before sending the message to the source process unit, and if the thread unit sends the message, the message is performed.
- the message unit usually contains two or more messages. If the thread unit does not encapsulate the message before sending the message, the message unit refers to a message.
- the process encapsulation package described in this application refers to a package package generated after the process unit performs encapsulation processing.
- the present application uses the parameters used in the encapsulation process of the source process unit of the sending end, and the parameters used in the encapsulation process of the thread unit of the source process unit are distinguished by the first and second.
- the parameters used by the source process unit in the encapsulation process include:
- the parameters used by the thread unit for the encapsulation process include:
- the size of the process encapsulation packet used is not fixed, but is sent to the sending queue of the source process unit according to the thread unit of the source process unit in the first historical time period.
- the frequency of the message unit is determined, so that the setting of the scale of the process encapsulation packet is more reasonable, avoiding the long idle time of the network channel when the scale of the process encapsulation packet is set too large, and avoiding that the size of the process encapsulation packet is set too small, resulting in The bandwidth of the network channel is wasted, and the number of times of encapsulation processing is large, causing a certain delay.
- the present application determines the frequency of sending the message unit to the sending queue of the source process unit according to the thread unit of the source process unit in the historical time period.
- the process encapsulation package has a more reasonable scale, which can improve the utilization of network resources and improve transmission efficiency.
- the first preset timing time is also set, if the destination process unit in the sending queue of the source process unit is the same process.
- the first waiting time of the message unit that enters the sending queue in the message unit of the unit is greater than or equal to the first preset timing time, and the destination process unit is encapsulated for the message unit of the same process unit, thereby avoiding the source process unit
- the frequency of sending a message unit by a thread unit is unstable, the number of message units cannot satisfy the scale of the process encapsulation packet for a long time, and the encapsulation processing cannot be performed, resulting in a problem that the message transmission delay is long.
- the message Before the thread unit of the source process unit sends the message unit to the send queue of the source process unit, the message may be encapsulated.
- the size of the thread encapsulation package may be fixed or determined according to the number of messages generated in the second historical time period, and the present invention is not limited thereto.
- the second preset timing time is also set, and the earliest message in the destination thread unit is the same thread unit. If the waiting time of the generated message is greater than or equal to the second preset timing time, the message of the same thread unit is encapsulated by the destination thread unit.
- the thread unit of the source process unit Before the thread unit of the source process unit encapsulates the generated message, it determines whether the destination thread unit of the message belongs to the source process unit. If the destination process unit of the message does not belong to the source process unit, the message is encapsulated and a message is generated. The unit sends the sending queue to the source process unit. If the destination process unit of the message belongs to the source process unit, it is directly sent to the receiving queue of the destination thread unit, that is, without first sending the message to the sending queue of the process unit, and then passing through the network channel. The sending queue sent to the process unit is sent to the destination thread unit, thereby shortening the delay of message transmission and improving the message transmission efficiency.
- FIG. 2 is a schematic structural diagram of Embodiment 1 of a message transmission system according to the present application.
- the system in this embodiment includes a meta process unit and a destination process unit, where the source process unit includes at least one thread unit, a source process unit, and The target process unit is connected; in FIG. 2, the source process unit is exemplified by process A, the destination process unit is shown by process B, and the source process unit includes at least one thread unit, which is exemplified by three thread units, which are respectively thread units. A1, thread unit A2, and thread unit A3; thread B may also include at least one thread unit, shown by thread unit B1, thread unit B2, and thread unit B3.
- the source process unit determines the frequency of the process encapsulation packet corresponding to the first current time segment of the source process unit according to the frequency at which the at least one thread unit sends the message unit to the sending queue of the source process unit according to the first historical time period, and the message unit includes At least one message; and according to the scale of the process encapsulation packet corresponding to the first current time period, encapsulating the message unit in the sending queue of the source process unit to generate a process encapsulation packet; and generating a process encapsulation packet and sending the process to the destination process unit Package package.
- the destination process unit when the source process unit sends the frequency of the message unit to the sending queue of the source process unit according to the first historical time period, the destination process unit is the destination process in the sending queue of the source process unit.
- the number of the message units of the unit is greater than or equal to the size of the process encapsulation packet corresponding to the first current time period, and the source process unit is the message unit of the destination process unit according to the size of the process encapsulation packet corresponding to the first current time period.
- the encapsulation process is performed to generate a first process encapsulation packet, where the number of message units included in the first process encapsulation packet is the same as the size of the process encapsulation packet corresponding to the first current time segment.
- the method further includes: if the destination process unit in the sending queue of the source process unit is the destination process The number of the message unit of the unit is smaller than the size of the process encapsulation packet corresponding to the first current time period, and the source process unit determines whether the first waiting time of the message unit of the message unit that is the first to enter the sending queue in the message unit of the destination process unit is greater than If the first waiting time is greater than or equal to the first preset timing time, the destination process unit is encapsulated by the message unit of the destination process unit to generate a second process encapsulation packet, and the second process encapsulation packet. All message units containing the destination process unit in the send queue as the destination process unit.
- the source process unit determines the process encapsulation packet corresponding to the first current time period of the source process unit according to the frequency at which the at least one thread unit sends the message unit to the sending queue of the source process unit according to the first historical time period.
- the first step is: the source process unit obtains the first quantity of the message unit sent by the first process encapsulation packet and the second process encapsulation packet in the first historical time period; and, after obtaining the first historical time period, The second process encapsulates the second quantity of the message unit sent by the packet; and determines, according to the second quantity and the first quantity ratio and the size of the process encapsulation packet corresponding to the first historical time period, the process encapsulation packet corresponding to the first current time period is determined. scale.
- the source process unit in the embodiment of the message transmission system shown in FIG. 2 can be used to implement the technical solution of the method embodiment shown in FIG. 3 to FIG. 5 , and the implementation principle and technical effects thereof are shown in the method embodiment shown in FIG. 3 to FIG. 5 . Detailed description of this, will not repeat them here.
- FIG. 3 is a schematic flowchart of the first embodiment of the message transmission method of the present application. As shown in FIG. 2, the embodiment is performed by a sending end. Specifically, S301-303 is executed by a source process unit of the sending end. The method in this embodiment is as follows:
- S301 Determine, according to a frequency of the message unit sent by the thread unit of the source process unit to the sending queue of the source process unit, the size of the process encapsulation packet corresponding to the first current time period of the source process unit.
- the message unit contains at least one message.
- the first current time period refers to encapsulation processing on the message unit in the sending queue of the source process unit; the first historical time period refers to the time period before the first current time period.
- the frequency of sending the message unit to the sending queue of the source process unit in the thread unit of the source process unit in the previous time period it can be more reasonable to estimate that the thread unit of the source process unit in the current time period sends a message to the sending queue of the source process unit.
- the frequency of the unit therefore, based on the frequency of the message unit sent by the thread unit of the source process unit to the sending queue of the source process unit in the first historical time period, determining the size of the process encapsulation packet corresponding to the first current time period of the source process unit, The scale of the determined process package is more reasonable.
- the size of the process encapsulation packet corresponding to the first current time period changes accordingly, that is, the first The scale of the process encapsulation packet corresponding to the current time period changes at any time during the first historical time period, and the thread unit of the source process unit changes the frequency of sending the message unit to the sending queue of the source process unit, thereby making the process encapsulation package scale setting More reasonable.
- S302 Encapsulate the message unit in the sending queue of the source process unit according to the size of the process encapsulation packet corresponding to the first current time period, and generate a process encapsulation packet.
- the size of the process encapsulation packet corresponding to the first current time segment is three message units
- the three message units of the same process unit in the sending queue of the source process unit are obtained, and the encapsulation process is performed to generate a process unit. package.
- the encapsulated packet is sent to the destination process unit through the network channel between the process units, so that the destination process unit performs corresponding decapsulation processing, and sends the message to the corresponding destination thread unit to complete the message transmission.
- the size of the process encapsulation packet corresponding to the first current time segment of the source process unit is determined according to the frequency of the message unit sent by the thread unit of the source process unit to the sending queue of the source process unit according to the first historical time period.
- the idle time of the network channel is long, and the bandwidth of the network packet is wasted due to the size of the process encapsulation packet.
- the send queue of the thread unit of the source process unit to the source process unit Message sending means determines the frequency scale more reasonable process capsule, can improve the utilization of network resources, and improve transmission efficiency.
- the triggering process unit performs the encapsulation process, where the first mode is: the number of the message unit in the sending process queue of the source process unit that is the same process unit in the same process unit is greater than or equal to the size of the process encapsulation packet corresponding to the first current time segment, The process unit is triggered to perform encapsulation processing.
- the second mode is: the number of the message unit in the sending process queue of the source process unit that is the same process unit is smaller than the size of the process encapsulation packet corresponding to the first current time segment, but the destination process unit is the message unit of the same process unit.
- the first waiting time of the first message unit that enters the sending queue is greater than or equal to the first preset timing time, and the process unit is triggered to perform message encapsulation processing.
- the process encapsulation packet generated by the encapsulation process triggered by the first method is described as a “first process encapsulation packet”
- the process encapsulation packet generated by the encapsulation process triggered by the second mode is described as “the second process”.
- Package package as shown in Figure 4, the present embodiment is as follows:
- S401 Determine whether the number of the message unit of the same process unit in the sending queue of the source process unit is greater than or equal to the size of the process package corresponding to the first current time segment.
- S402 Encapsulate the message unit of the same process unit according to the size of the process encapsulation packet corresponding to the first current time period, and generate a first process encapsulation packet.
- the number of message units included in the first process encapsulation packet is the same as the size of the process encapsulation packet corresponding to the first current time period.
- the process unit is triggered by the first method to perform encapsulation processing.
- S403 Determine whether the first waiting time of the message unit that is the earliest entering the sending queue in the message unit of the same process unit is greater than or equal to the first preset timing time.
- the process returns to S401.
- the first preset timing time may be set according to an empirical value.
- the first waiting time is monitored by a dedicated thread unit (described as a timing thread unit).
- the timing thread unit sends an indication message to the source process unit to trigger the source process unit. Perform packaging processing.
- S404 Encapsulate the message unit of the same process unit for the destination process unit, and generate a second process package.
- the second process encapsulation packet includes all message units in the sending queue whose destination process unit is the same process unit.
- the second method is used to trigger the encapsulation process.
- the process unit is triggered to perform the encapsulation process in two ways.
- the number of the message unit in the sending process queue of the source process unit is the same as the process encapsulation packet corresponding to the first current time segment, And triggering, according to the size of the process encapsulation packet corresponding to the first current time period, encapsulating the message unit of the same process unit into the destination process unit; and when the destination process unit in the sending queue of the source process unit is the message unit of the same process unit,
- the quantity is smaller than the size of the process encapsulation packet corresponding to the first current time period, but the first waiting time of the message unit that is the earliest into the sending queue in the message unit of the same process unit is greater than or equal to the first preset timing time.
- Trigger for message encapsulation processing when the frequency of sending the message unit by the thread unit of the source process unit is unstable, the packet processing cannot be performed because the number of message units cannot meet the scale of the process encapsulation packet for a long time, resulting in a problem that the message transmission delay is long.
- FIG. 5 is a schematic flowchart of a method for transmitting a message according to Embodiment 3 of the present application. This embodiment is a description of a possible implementation manner of S301 based on the embodiment shown in Embodiment 2, as shown in FIG. 5:
- S501 Acquire a message sent by the first process encapsulation packet and the second process encapsulation packet in the first historical time period. The first number of units.
- S502 Acquire a second quantity of message units sent by the second process encapsulation packet in the first historical time period.
- the execution order of S501 and S502 is not limited.
- S503 Determine, according to the ratio of the second quantity and the first quantity, and the size of the process encapsulation packet corresponding to the first historical time period, the size of the process encapsulation packet corresponding to the first current time period.
- the ratio of the frequency of the message unit sent by the thread unit of the source process unit to the sending queue of the source process unit in the first historical time period is determined by the ratio of the second quantity and the first quantity, and the first preset threshold is usually set to 0.5. If the ratio is greater than the first preset threshold, the frequency at which the thread unit sends the message unit to the sending queue of the source process unit is slow, and most of the messages are triggered by the second method, so the process encapsulation is reduced. The scale of the package. If the ratio is greater than 0.5, the frequency at which the thread unit sends the message unit to the sending queue of the source process unit becomes faster. Most of the messages are triggered by the first method for encapsulation processing. Therefore, the size of the process encapsulation packet is increased.
- the ratio is greater than the first preset threshold, determining that the size of the process encapsulation packet corresponding to the first current time period is the product of the size of the process encapsulation packet corresponding to the first historical time period and the first coefficient, where the first coefficient is less than 1 .
- the size of the process encapsulation packet corresponding to the first current time period is smaller than the size of the process encapsulation packet corresponding to the first historical time period.
- the size of the process encapsulation packet corresponding to the first current time period is the product of the size of the process encapsulation packet corresponding to the first historical time period and the second coefficient, where the second coefficient is greater than 1.
- the size of the process encapsulation packet corresponding to the first current time period is smaller than the size of the process encapsulation packet corresponding to the first historical time period.
- the ratio of the first quantity to the third quantity is a second coefficient, wherein the third quantity is the number of message units sent by the first process encapsulation packet and the second process encapsulation packet in a previous period of the first historical time period.
- the second quantity of the information unit determines the size of the process encapsulation packet corresponding to the first current time period according to the ratio of the second quantity and the first quantity and the size of the process encapsulation packet corresponding to the first historical time period.
- FIG. 6 is a schematic structural diagram of Embodiment 1 of a message transmission apparatus according to the present application.
- the apparatus of this embodiment includes a processing module 601, a packaging module 602, and a sending module 603, where the processing module 601 is configured to use a source process unit according to a first historical time period.
- the thread unit sends the frequency of the message unit to the sending queue of the source process unit, determines the size of the process encapsulation packet corresponding to the first current time period of the source process unit, and the message unit includes at least one message; the encapsulating module 602 is configured to use the first current The size of the process encapsulation packet corresponding to the time segment is encapsulated by the message unit in the sending queue of the source process unit to generate a process encapsulation packet, and the sending module 603 is configured to send the process encapsulation packet.
- the device in this embodiment is corresponding to the technical solution shown in the first embodiment of the message transmission method, and the implementation principle and the technical effect are similar, and details are not described herein again.
- the process encapsulation package includes: a first process encapsulation package
- the encapsulation module 602 is specifically configured to: if the number of the message units in the sending process queue of the source process unit that are the same process unit is greater than or equal to the size of the process encapsulation packet corresponding to the first current time segment, according to the first current time segment
- the process encapsulation packet is encapsulated by the destination process unit for the message unit of the same process unit to generate a first process encapsulation packet, where the number of message units included in the first process encapsulation packet corresponds to the first current time segment.
- the process package has the same scale.
- the process encapsulation package further includes: a second process encapsulation package;
- the encapsulating module 602 is further configured to determine that the target process unit is the same process unit, if the number of the message unit in the sending process queue of the source process unit is the same as the process encapsulation packet corresponding to the first current time segment. Whether the first waiting time of the message unit that first enters the sending queue is greater than or equal to the first preset timing time, and if the first waiting time is greater than or equal to the first preset timing time, the target process unit is the same process unit.
- the message unit performs encapsulation processing to generate a second process encapsulation packet, and the second process encapsulation packet includes all message units in the transmission queue whose destination process unit is the same process unit.
- the device in this embodiment is corresponding to the technical solution shown in the second embodiment of the message transmission method, and the implementation principle and the technical effect are similar, and details are not described herein again.
- the processing module 601 is specifically configured to acquire, in a first historical time period, a first quantity of message units sent by the first process encapsulation packet and the second process encapsulation packet, and obtain the first historical time period, Second entry The second quantity of the message unit sent by the package encapsulation packet; determining the size of the process encapsulation packet corresponding to the first current time period according to the ratio of the second quantity and the first quantity and the size of the process encapsulation packet corresponding to the first historical time period.
- the processing module 601 is specifically configured to: if the ratio is greater than the first preset threshold, determine that the size of the process encapsulation packet corresponding to the first current time period is the product of the scale of the process encapsulation packet corresponding to the first historical time period and the first coefficient. Where the first coefficient is less than one.
- the processing module 601 is further configured to: if the ratio is less than or equal to the first preset threshold, determine that the size of the process encapsulation packet corresponding to the first current time period is a scale and a second coefficient of the process encapsulation packet corresponding to the first historical time period. The product of which the second coefficient is greater than one.
- the processing module 601 is further configured to determine that the ratio of the first quantity to the third quantity is the second coefficient, where the third quantity is the previous time period of the first historical time period and is encapsulated by the first process encapsulation packet and the second process. The number of message units sent by the packet.
- the device of this embodiment is corresponding to the technical solution shown in the third embodiment of the message transmission method, and the implementation principle and the technical effect are similar, and details are not described herein again.
- FIG. 7 is a schematic structural diagram of Embodiment 2 of a message transmission apparatus according to the present application.
- the apparatus of this embodiment includes a processor 701 and a transmitter 702, where the processor 701 is configured to source a thread unit according to a source unit of a first historical time period. The frequency of the message unit sent by the sending queue of the process unit is determined, the size of the process encapsulation packet corresponding to the first current time period of the source process unit is determined, and the message unit includes at least one message; the processor 701 is further configured to correspond to the first current time period according to the first current time period.
- the process encapsulates the packet size, encapsulates the message unit in the sending queue of the source process unit, and generates a process encapsulation packet;
- the transmitter 702 transmitter is coupled to the processor, and the transmitter is configured to send the process encapsulation packet.
- the device in this embodiment is corresponding to the technical solution shown in the first embodiment of the message transmission method, and the implementation principle and the technical effect are similar, and details are not described herein again.
- the process encapsulation package includes: a first process encapsulation package
- the processor 701 is specifically configured to: if the number of the message units of the same process unit in the sending queue of the source process unit is greater than or equal to the size of the process encapsulation packet corresponding to the first current time segment, the processor is configured according to the first current time segment.
- the process encapsulation packet is encapsulated by the destination process unit for the message unit of the same process unit to generate a first process encapsulation packet, where the number of message units included in the first process encapsulation packet corresponds to the first current time segment.
- the process package has the same scale.
- the process encapsulation package further includes: a second process encapsulation package;
- the processor 701 is further configured to: if the number of the message units in the sending process queue of the source process unit that are the same process unit is smaller than the size of the process encapsulation packet corresponding to the first current time segment, determine that the target process unit is the same process unit. Whether the first waiting time of the message unit that first enters the sending queue is greater than or equal to the first preset timing time, and if the first waiting time is greater than or equal to the first preset timing time, the target process unit is the same process unit.
- the message unit performs encapsulation processing to generate a second process encapsulation packet, and the second process encapsulation packet includes all message units in the transmission queue whose destination process unit is the same process unit.
- the device in this embodiment is corresponding to the technical solution shown in the second embodiment of the message transmission method, and the implementation principle and the technical effect are similar, and details are not described herein again.
- the processor 701 is specifically configured to acquire, by using a first process encapsulation packet and a second process encapsulation packet, a first quantity of message units in a first historical time period; and, in obtaining a first historical time period, Determining, by the second process, the second quantity of the message unit that is sent by the second process; determining, according to the second quantity and the first quantity ratio and the size of the process encapsulation packet corresponding to the first historical time period, the process encapsulation packet corresponding to the first current time period The scale.
- the processor 701 is specifically configured to: if the ratio is greater than the first preset threshold, determine that the size of the process encapsulation packet corresponding to the first current time period is the product of the scale of the process encapsulation packet corresponding to the first historical time period and the first coefficient. Where the first coefficient is less than one.
- the processor 701 is further configured to: if the ratio is less than or equal to the first preset threshold, determine that the size of the process encapsulation packet corresponding to the first current time period is a scale and a second coefficient of the process encapsulation packet corresponding to the first historical time period. The product of which the second coefficient is greater than one.
- the processor 701 is further configured to determine that the ratio of the first quantity to the third quantity is the second coefficient, where the third quantity is the previous time period of the first historical time period and is encapsulated by the first process encapsulation packet and the second process. The number of message units sent by the packet.
- the device of this embodiment is corresponding to the technical solution shown in the third embodiment of the message transmission method, and the implementation principle and the technical effect are similar, and details are not described herein again.
- Embodiment 2 of a message transmission system includes a source process unit, and the source process unit includes at least one thread unit.
- the source process unit in FIG. 8 is shown by process unit A.
- At least one thread unit is shown by a thread unit A1, a thread unit A2, and a thread unit A3, wherein the thread unit performs encapsulation processing on the message generated by the thread unit, generates a message unit, and the message unit includes at least two messages;
- the send queue of the process unit sends a message unit.
- the thread unit encapsulates the message generated by the thread unit to generate a message unit, and specifically: the thread unit encapsulates the message generated by the thread unit according to the size of the thread encapsulation package corresponding to the second current time period. , generating a message unit;
- the thread unit performs encapsulation processing on the message generated by the thread unit. Before generating the message unit, the thread unit determines the thread encapsulation corresponding to the second current time period according to the number of messages generated by the thread unit in the second historical time period. The scale of the package.
- the thread unit encapsulates the message generated by the thread unit according to the size of the thread encapsulation package corresponding to the second current time period, and when the message unit is generated, the thread unit is specifically:
- the thread unit is specifically configured to: if the number of messages of the thread unit generated by the thread unit being the same thread unit is greater than or equal to the size of the thread package package corresponding to the second current time period, the target thread unit is the same according to the scale of the thread package.
- the thread unit's message is encapsulated to generate a first message unit, wherein the number of messages included in the first message unit is the same as the size of the thread package.
- the thread unit encapsulates the message generated by the thread unit according to the size of the thread encapsulation package corresponding to the second current time period, and when the message unit is generated, the thread unit is specifically:
- the thread unit is further configured to: if the number of messages of the thread unit generated by the thread unit being the same thread unit is smaller than the size of the thread package package corresponding to the second current time period, determining that the destination thread unit is the earliest message in the same thread unit If the second waiting time of the message is greater than or equal to the second preset timing time, if the second waiting time is greater than or equal to the second preset timing time, the destination thread unit is encapsulated by the same thread unit to generate a second message. a unit, wherein the second message unit includes all messages in which the destination thread unit generated by the thread unit is the same thread unit.
- the thread unit determines, according to the number of messages generated by the thread unit in the second historical time period, the size of the thread encapsulation package corresponding to the second current time period, specifically:
- the thread unit is specifically configured to acquire a third quantity of the message sent by the first message unit and the second message unit in the second historical time period; and acquire the message sent by the second message unit in the second historical time period.
- the fourth quantity is determined according to the ratio of the fourth quantity and the third quantity and the size of the thread encapsulation package corresponding to the second historical time period, and the size of the thread encapsulation package corresponding to the second current time period is determined.
- the source process unit in the embodiment of the message transmission system shown in FIG. 8 is specifically configured to perform the technical solution of the method embodiment shown in FIG. 9 to FIG. 12, and the implementation principle and technical effects thereof are shown in the method embodiment shown in FIG. 9 to FIG. Detailed description of this, will not repeat them here.
- FIG. 9 is a schematic flowchart of the fourth embodiment of the message transmission method of the present application.
- the embodiment is performed by the thread unit of the sending end, and the technical solution corresponding to the embodiment may be performed independently, or may be combined with the foregoing embodiments, in the foregoing implementations.
- the basic implementation of the example as follows:
- S901 Encapsulate the message generated by the thread unit to generate a message unit.
- the message unit contains at least two messages.
- the size of the thread encapsulation packet used for encapsulating the message generated by the thread unit may be fixed, or may be dynamically determined according to the number of messages generated by the thread unit in the second historical time period. Therefore, this application does not limit the matter.
- S902 Send the foregoing message unit to a sending queue of the source process unit.
- the thread unit performs encapsulation processing on the message generated by the thread unit, generates a message unit, and sends a message unit to the sending queue of the source process unit. Further, the packet processing is performed at the thread unit to further improve the performance of the message transmission.
- Embodiment 5 of the message transmission method of the present application.
- the present embodiment is based on the embodiment shown in FIG. 9. Further, before executing S901, the method further includes:
- S1000 Determine, according to the number of messages generated by the thread unit in the second historical time period, the size of the thread encapsulation package corresponding to the second current time period.
- the size of the thread encapsulation package corresponding to the second current time period is determined according to the number of messages generated by the thread unit in the second historical time period, and the scale setting of the thread encapsulation package is more reasonable.
- FIG. 11 is a schematic flowchart of a method for transmitting a message according to Embodiment 6 of the present application.
- the present embodiment is a description of a possible implementation manner of S901, based on the embodiment shown in Embodiment 5 or Embodiment 6, wherein
- the thread unit may be triggered to perform the encapsulation process in two ways, wherein the first mode is: the number of messages of the thread unit generated by the thread unit being the same thread unit is greater than or equal to the thread encapsulation packet corresponding to the second current time period.
- the scale triggers the thread unit to perform encapsulation processing.
- the second way is: the number of messages of the thread unit generated by the thread unit being the same thread unit is smaller than the size of the thread encapsulation packet corresponding to the second current time period, but the destination thread unit is the earliest generated message in the message of the same thread unit.
- the second waiting time is greater than or equal to the second preset timing time, and the threading unit is triggered to perform message encapsulation processing.
- the message unit generated by the method of triggering the thread unit to perform the encapsulation process is described as a “first message unit”, and the message unit generated by the second thread of the thread unit performing the encapsulation process is described as “the second message unit”, as shown in FIG. 11 .
- This implementation is as follows:
- S1101 Determine whether the number of the message that the destination thread unit generated by the thread unit is the same thread unit is greater than or equal to the size of the thread encapsulation package corresponding to the second current time period.
- S1102 Encapsulate the message of the same thread unit by the destination thread unit according to the scale of the thread encapsulation package, and generate a first message unit.
- the number of messages included in the first message unit is the same as the size of the thread encapsulation package.
- the threading unit is triggered by the first method to perform encapsulation processing.
- S1103 Determine whether the second waiting time of the earliest generated message in the message that the destination thread unit is the same thread unit is greater than or equal to the second preset timing time.
- the second preset timing time may be set according to an empirical value.
- the second waiting time is monitored by a dedicated thread unit (described as a timing thread unit).
- the timing thread unit sends an indication message to the thread unit that generates the message, triggering generation.
- the thread unit of the message performs encapsulation processing.
- S1104 Encapsulate the message that the destination thread unit is the same thread unit, and generate a second message unit.
- the second message unit includes all messages of the same thread unit generated by the thread unit.
- the thread unit is triggered to perform the encapsulation process in the second manner.
- the thread unit is triggered to perform the encapsulation process in two ways.
- the thread is triggered according to the thread.
- the size of the encapsulation packet is encapsulated by the destination thread unit for the same thread unit to generate a first message unit; when the thread unit generates the destination thread unit, the number of messages of the same thread unit is smaller than the thread corresponding to the second current time period.
- the triggering thread unit performs encapsulation processing on the message of the same thread unit by the destination thread unit to generate a second message unit, thereby avoiding generation by the thread unit.
- the frequency of the message is unstable, the number of messages cannot meet the scale of the thread encapsulation packet for a long time, and the encapsulation process cannot be performed, resulting in a problem that the message transmission delay is long.
- FIG. 12 is a schematic flowchart of a seventh embodiment of the message transmission method of the present application. The embodiment is based on the embodiment shown in the sixth embodiment, and further, a description of a possible implementation manner of the S1000, as shown in FIG. Show:
- S1201 Acquire a third number of messages sent by the first message unit and the second message unit in the second historical time period.
- S1202 Acquire a fourth quantity of the message sent by the second message unit in the second historical time period.
- the execution order of S1201 and S1202 is not limited.
- S1203 Determine, according to the ratio of the fourth quantity and the third quantity, and the size of the thread encapsulation package corresponding to the second historical time period, the size of the thread encapsulation package corresponding to the second current time period.
- the ratio of the frequency of the message generated by the thread unit in the second historical time period is obtained by the ratio of the fourth quantity and the third quantity.
- the second preset threshold is usually set to 0.5. If the ratio is greater than the second preset threshold, the thread unit is used. The frequency of generating messages is slow. Most of the messages are triggered by the thread unit in the second way. Therefore, the size of the thread encapsulation package is reduced. If the ratio is greater than 0.5, the frequency of the thread unit generating the message becomes faster. Most of the messages are triggered by the thread unit in the first way. Therefore, the scale of the thread encapsulation package is increased.
- the thread encapsulation package corresponding to the second historical time period has a size greater than one.
- the ratio is greater than the second preset threshold, determining that the size of the thread encapsulation packet corresponding to the second current time period is the product of the size of the thread encapsulation packet corresponding to the second historical time period and the third coefficient, wherein the third coefficient is less than 1 .
- the size of the thread encapsulation packet corresponding to the second current time period is smaller than the size of the process encapsulation packet corresponding to the second historical time period.
- determining that the size of the thread encapsulation packet corresponding to the second current time period is The product of the thread encapsulation packet corresponding to the second historical time period and the fourth coefficient, wherein the fourth coefficient is greater than 1.
- the size of the process encapsulation packet corresponding to the second current time period is smaller than the size of the process encapsulation packet corresponding to the second historical time period.
- the fourth quantity determines the size of the thread encapsulation package corresponding to the second current time period according to the ratio of the fourth quantity and the third quantity and the size of the thread encapsulation package corresponding to the second historical time period, thereby making the scale of the thread encapsulation package The setting is more reasonable.
- the apparatus in this embodiment includes a package module 1301 and a sending module 1302.
- the encapsulation module 1301 is configured to encapsulate a message generated by a thread unit, and generate a message unit.
- the message unit includes at least two messages; the sending module 1302 is configured to send the message unit to the send queue of the source process unit.
- the device in this embodiment is applicable to the technical solution shown in Embodiment 4 of the message transmission method, and the implementation principle and the technical effect are similar, and details are not described herein again.
- the encapsulating module 1301 is specifically configured to perform encapsulation processing on a message generated by the thread unit according to a scale of the thread encapsulation packet corresponding to the second current time period, to generate a message unit.
- the method further includes: the processing module 1303, configured to determine, according to the number of messages generated by the thread unit in the second historical time period, the size of the thread encapsulation package corresponding to the second current time period.
- the device in this embodiment is corresponding to the technical solution shown in the fifth embodiment of the message transmission method, and the implementation principle and the technical effect are similar, and details are not described herein again.
- the message unit includes a first message unit
- the encapsulation module 1301 is specifically configured to: if the number of messages of the thread unit generated by the thread unit being the same thread unit is greater than or equal to the size of the thread encapsulation packet corresponding to the second current time period, according to the scale of the thread encapsulation package, the target thread unit is The message of the same thread unit is encapsulated to generate a first message unit, wherein the number of messages included in the first message unit is the same as the size of the thread package.
- the message unit further includes a second message unit
- the encapsulation module 1301 is further configured to determine that the destination thread unit is the same thread if the number of the destination thread unit generated by the thread unit is less than the size of the thread encapsulation package corresponding to the second current time period. Whether the second waiting time of the first generated message in the message of the unit is greater than or equal to the second preset timing time. If the second waiting time is greater than or equal to the second preset timing time, the destination thread unit encapsulates the message of the same thread unit. Processing, generating a second message unit, wherein the second message unit includes all messages in which the destination thread unit generated by the thread unit is the same thread unit.
- the device in this embodiment is applicable to the technical solution shown in Embodiment 6 of the message transmission method, and the implementation principle and the technical effect are similar, and details are not described herein again.
- the processing module 1303 is specifically configured to acquire a third number of messages sent by the first message unit and the second message unit in the second historical time period; and acquire the second historical time period by using the second The fourth quantity of the message sent by the message unit; determining the size of the thread encapsulation package corresponding to the second current time period according to the ratio of the fourth quantity and the third quantity and the size of the thread encapsulation package corresponding to the second historical time period.
- the processing module 1303 is specifically configured to: if the ratio is greater than the second preset threshold, determine that the size of the thread encapsulation packet corresponding to the second current time period is the product of the size of the thread encapsulation packet corresponding to the second historical time period and the third coefficient. Where the third coefficient is less than one.
- the processing module 1303 is further configured to: if the ratio is less than or equal to the second preset threshold, determine that the size of the thread encapsulation packet corresponding to the second current time period is the size and the fourth coefficient of the thread encapsulation packet corresponding to the second historical time period. The product of which the fourth coefficient is greater than one.
- the device in this embodiment is corresponding to the technical solution shown in the seventh embodiment of the message transmission method, and the implementation principle and the technical effect are similar, and details are not described herein again.
- FIG. 14 is a schematic structural diagram of Embodiment 4 of the message transmission apparatus of the present application.
- the apparatus of this embodiment includes a processor 1401 and a transmitter 1402, where the processor 1401 is configured to perform encapsulation processing on a message generated by a thread unit, and generate a message unit.
- the message unit contains at least two messages; the transmitter 1402 transmitter is coupled to the processor, and the transmitter is configured to send the message unit to the transmit queue of the source process unit.
- the device in this embodiment is applicable to the technical solution shown in Embodiment 4 of the message transmission method, and the implementation principle and the technical effect are similar, and details are not described herein again.
- the processor 1401 is specifically configured to perform encapsulation processing on a message generated by a thread unit according to a scale of a thread encapsulation packet corresponding to the second current time period, to generate a message unit.
- the processor 1401 is further configured to: according to the number of messages generated by the thread unit in the second historical time period, Determining a scale of a thread encapsulation package corresponding to the second current time period.
- the device in this embodiment is corresponding to the technical solution shown in the fifth embodiment of the message transmission method, and the implementation principle and the technical effect are similar, and details are not described herein again.
- the message unit includes a first message unit
- the processor 1401 is specifically configured to: if the number of messages of the thread unit generated by the thread unit being the same thread unit is greater than or equal to the size of the thread encapsulation packet corresponding to the second current time period, according to the scale of the thread encapsulation packet, the target thread unit is The message of the same thread unit is encapsulated to generate a first message unit, wherein the number of messages included in the first message unit is the same as the size of the thread package.
- the message unit further includes a second message unit
- the processor 1401 is further configured to: if the number of messages of the thread unit generated by the thread unit being the same thread unit is smaller than the size of the thread encapsulation packet corresponding to the second current time period, determine that the destination thread unit is the earliest message of the same thread unit. Whether the second waiting time of the generated message is greater than or equal to the second preset timing time. If the second waiting time is greater than or equal to the second preset timing time, the destination thread unit encapsulates the message of the same thread unit to generate a second a message unit, wherein the second message unit includes all messages in which the destination thread unit generated by the thread unit is the same thread unit.
- the device in this embodiment is applicable to the technical solution shown in Embodiment 6 of the message transmission method, and the implementation principle and the technical effect are similar, and details are not described herein again.
- the processor 1401 is specifically configured to acquire a third number of messages sent by the first message unit and the second message unit in the second historical time period; and acquire the second historical time period by using the second The fourth quantity of the message sent by the message unit; determining the size of the thread encapsulation package corresponding to the second current time period according to the ratio of the fourth quantity and the third quantity and the size of the thread encapsulation package corresponding to the second historical time period.
- the processor 1401 is specifically configured to: if the ratio is greater than the second preset threshold, determine that the size of the thread encapsulation packet corresponding to the second current time period is the size and third of the thread encapsulation packet corresponding to the second historical time period. The product of the coefficients, where the third coefficient is less than one.
- the processor 1401 is further configured to: if the ratio is less than or equal to the second preset threshold, determine that the size of the thread encapsulation packet corresponding to the second current time period is a scale of the thread encapsulation package corresponding to the second historical time period. The product of the fourth coefficient, wherein the fourth coefficient is greater than one.
- the device of this embodiment is corresponding to the technical solution shown in the seventh embodiment of the message transmission method.
- the present principle and technical effects are similar and will not be described here.
- FIG. 15 is a schematic structural diagram of Embodiment 3 of a message transmission system according to the present application.
- the system includes a process unit, and the process unit includes a source thread unit and a destination thread unit.
- the process unit is a process unit A. Shown that the source thread unit is shown in thread unit A1, the destination thread unit is shown in thread unit A2; the source thread unit determines whether the destination thread unit of the message generated by the source thread unit belongs to the same process unit; the source thread unit if the purpose of the message When the thread unit belongs to the same process unit, the message is sent to the receive queue of the destination thread unit.
- the source process unit in the embodiment of the message transmission system shown in FIG. 15 is specifically configured to perform the technical solution of the method embodiment shown in FIG. 16 , and the implementation principle and technical effects thereof are described in detail in the method embodiment shown in FIG. 16 . No longer.
- FIG. 16 is a schematic flowchart of Embodiment 8 of the message transmission method of the present application.
- the technical solution corresponding to the embodiment may be performed independently, or may be performed on the basis of the foregoing embodiments in combination with the foregoing embodiments, as follows:
- the source thread unit determines whether the destination thread unit of the generated message belongs to the same process unit as the source thread unit.
- the source thread unit is the thread unit A1
- the destination thread unit of the generated message is the thread unit A2 or the thread unit A3
- the destination thread unit of the generated message is considered to belong to the same process unit as the source thread unit.
- the source thread unit is the thread unit A1 and the destination thread unit of the generated message is the thread unit B1, the thread unit B2, or the thread unit B3, the destination thread unit of the generated message and the source thread unit are not belonged to the same process unit.
- S1602 The source thread unit sends a message to the receive queue of the destination thread unit.
- the destination thread unit of the message generated by the thread unit A1 in FIG. 1 is the thread unit A2, then directly in the process unit A, the message is sent from the thread unit A1 to the receiving queue of the thread unit A2.
- the message is directly sent to the destination thread unit.
- the receiving queue thereby shortening the delay of message transmission and improving the efficiency of message transmission.
- Figure 17 is a schematic structural diagram of Embodiment 5 of the message transmission apparatus of the present application.
- the apparatus of this embodiment includes a processing module 1701 and a sending module 1702, wherein the processing module 1701 is configured to determine whether the destination thread unit of the generated message belongs to the source thread unit. The same process unit; the sending module 1702 is configured to send a message to the receiving queue of the destination thread unit if the destination thread unit of the message belongs to the same process unit as the source thread unit.
- the device in this embodiment is corresponding to the technical solution shown in the eighth embodiment of the message transmission method, and the implementation principle and the technical effect are similar, and details are not described herein again.
- Figure 18 is a schematic structural diagram of Embodiment 6 of the message transmission apparatus of the present application.
- the apparatus of this embodiment includes a processor 1801 and a transmitter 1802, wherein the processor 1801 is configured to determine whether the destination thread unit of the generated message belongs to the source thread unit.
- the transmitter 1802 is coupled to the processor 1801, and the transmitter 1802 is configured to send the message to the receive queue of the destination thread unit if the destination thread unit of the message belongs to the same process unit as the source thread unit.
- the device in this embodiment is corresponding to the technical solution shown in the eighth embodiment of the message transmission method, and the implementation principle and the technical effect are similar, and details are not described herein again.
- the present application may also provide a processor readable storage medium having stored therein program instructions for causing a processor to execute all or part of the steps of the first to eighth embodiments of the message transmission method.
- the readable storage storage medium described above can be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM). , erasable programmable read only memory (EPROM), programmable read only memory (PROM), read only memory (ROM), magnetic memory, flash memory, disk or optical disk
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Telephonic Communication Services (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
一种消息传输系统、方法和装置,通过根据第一历史时间段源进程单元的线程单元向源进程单元的发送队列发送消息单元的频率,确定源进程单元的第一当前时间段对应的进程封装包的尺度(S301),根据第一当前时间段对应的进程封装包的尺度,对源进程单元的发送队列中的消息单元进行封装处理,生成进程封装包(S302),发送进程封装包(S303),实现消息传输,提高网络资源的利用率,以及提高传输效率。
Description
本申请要求2016年08月25日递交的申请号为201610726969.6、发明名称为“消息传输系统、方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及计算机技术,尤其涉及一种消息传输系统、方法和装置。
在实时计算系统中,一个进程单元可以包含一个或者多个线程单元,进程单元之间、进程单元内的线程单元之间会涉及到大量的消息传输。
现有技术中,为了提高消息传输的性能,通常将同一个进程单元内的线程单元产生的消息发送到该进程单元的发送队列,该进程单元根据进程封装包的固定的尺度(尺度指进程封装包中包含的消息的数量)对发送队列中的消息进行封装(Batch)处理,通过网络通道将封装处理后生成的进程封装包从一个进程单元传输到另一个进程单元,接收到进程封装包的进程单元再进行相应的消息解封装处理,将解封装处理后得到的消息发送到对应的线程单元。例如:进程单元A包含线程单元A1、线程单元A2和线程单元A3,进程单元B包含线程单元B1、线程单元B2和线程单元B3,进程单元A的线程单元和进程单元B的线程单元之间存在消息传输,则将线程单元A1、线程单元A2和线程单元A3产生的消息发送到进程单元A的发送队列,根据进程封装包的固定的尺度对进程单元A的发送队列中的消息进行封装处理,将封装处理后生成的封装包通过进程单元A和进程单元B之间的网络通道发送给进程单元B,进程单元B接收到进程封装包再进行相应的消息解封装处理,将解封装处理后得到的消息发送到对应的线程单元。
然而,采用现有技术的方法,进行消息传输时,网络资源的利用率不高。
发明内容
本申请提供一种消息传输系统、方法和装置,以解决现有技术中网络资源的利用率不高的问题。
一个方面,本申请提供一种消息传输系统,包括:
源进程单元和目的进程单元,所述源进程单元包含至少一个线程单元,所述源进程
单元和所述目的进程单元连接;
其中,所述源进程单元,用于根据第一历史时间段所述至少一个线程单元向所述源进程单元的发送队列发送消息单元的频率,确定所述源进程单元的第一当前时间段对应的进程封装包的尺度,所述消息单元中包含至少一个消息;
所述源进程单元,还用于根据所述第一当前时间段对应的进程封装包的尺度,对所述源进程单元的发送队列中的消息单元进行封装处理,生成进程封装包;
所述源进程单元,还用于向所述目的进程单元发送所述进程封装包。
作为一种可实现方式,所述源进程单元具体用于若所述源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量大于等于所述第一当前时间段对应的进程封装包的尺度,则按照所述第一当前时间段对应的进程封装包的尺度,对所述目的进程单元为同一进程单元的消息单元进行封装处理,生成第一进程封装包,其中,所述第一进程封装包中包含的消息单元的数量与所述第一当前时间段对应的进程封装包的尺度相同。
作为一种可实现方式,所述源进程单元还具体用于若所述源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量小于所述第一当前时间段对应的进程封装包的尺度,则确定所述目的进程单元为同一进程单元的消息单元中最早进入所述发送队列的消息单元的第一等待时间是否大于等于第一预设定时时间,若所述第一等待时间大于等于所述第一预设定时时间,则对所述目的进程单元为同一进程单元的消息单元进行封装处理,生成第二进程封装包,所述第二进程封装包中包含所述发送队列中目的进程单元为同一进程单元的所有消息单元。
作为一种可实现方式,所述源进程单元具体用于获取所述第一历史时间段内,通过所述第一进程封装包和所述第二进程封装包发送的消息单元的第一数量;以及,获取所述第一历史时间段内,通过所述第二进程封装包发送的消息单元的第二数量;根据所述第二数量和所述第一数量的比值以及所述第一历史时间段对应的进程封装包的尺度,确定所述第一当前时间段对应的进程封装包的尺度。
另一方面,本申请提供一种消息传输方法,包括:
根据第一历史时间段源进程单元的线程单元向所述源进程单元的发送队列发送消息单元的频率,确定所述源进程单元的第一当前时间段对应的进程封装包的尺度,所述消息单元中包含至少一个消息;
根据所述第一当前时间段对应的进程封装包的尺度,对所述源进程单元的发送队列
中的消息单元进行封装处理,生成进程封装包;
发送所述进程封装包。
作为一种可实现方式,所述进程封装包包括:第一进程封装包;
所述根据所述第一当前时间段对应的进程封装包的尺度,对所述源进程单元的发送队列中的消息单元进行封装处理,生成进程封装包,包括:
若所述源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量大于等于所述第一当前时间段对应的进程封装包的尺度,则按照所述第一当前时间段对应的进程封装包的尺度,对所述目的进程单元为同一进程单元的消息单元进行封装处理,生成第一进程封装包,其中,所述第一进程封装包中包含的消息单元的数量与所述第一当前时间段对应的进程封装包的尺度相同。
作为一种可实现方式,所述进程封装包还包括:第二进程封装包;
所述方法还包括:
若所述源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量小于所述第一当前时间段对应的进程封装包的尺度,则确定所述目的进程单元为同一进程单元的消息单元中最早进入所述发送队列的消息单元的第一等待时间是否大于等于第一预设定时时间,若所述第一等待时间大于等于所述第一预设定时时间,则对所述目的进程单元为同一进程单元的消息单元进行封装处理,生成第二进程封装包,所述第二进程封装包中包含所述发送队列中目的进程单元为同一进程单元的所有消息单元。
作为一种可实现方式,所述根据第一历史时间段源进程单元的线程单元向所述源进程单元的发送队列发送消息单元的频率,确定所述源进程单元的第一当前时间段对应的进程封装包的尺度,包括:
获取所述第一历史时间段内,通过所述第一进程封装包和所述第二进程封装包发送的消息单元的第一数量;以及,
获取所述第一历史时间段内,通过所述第二进程封装包发送的消息单元的第二数量;
根据所述第二数量和所述第一数量的比值以及所述第一历史时间段对应的进程封装包的尺度,确定所述第一当前时间段对应的进程封装包的尺度。
作为一种可实现方式,所述根据所述第二数量和所述第一数量的比值以及所述第一历史时间段对应的进程封装包的尺度,确定所述第一当前时间段对应的进程封装包的尺度,包括:
若所述比值大于第一预设阈值,则确定所述第一当前时间段对应的进程封装包的尺
度为所述第一历史时间段对应的进程封装包的尺度与第一系数的乘积,其中,所述第一系数小于1。
作为一种可实现方式,还包括:
若所述比值小于等于所述第一预设阈值,则确定所述第一当前时间段对应的进程封装包的尺度为所述第一历史时间段对应的进程封装包的尺度与第二系数的乘积,其中,所述第二系数大于1。
作为一种可实现方式,还包括:
确定所述第一数量与第三数量的比值为所述第二系数,其中,所述第三数量为所述第一历史时间段的前一时间段通过所述第一进程封装包和所述第二进程封装包发送的消息单元的数量。
作为一种可实现方式,所述第一预设阈值为0.5。
再一方面,本申请提供一种消息传输装置,包括:
处理模块,用于根据第一历史时间段源进程单元的线程单元向所述源进程单元的发送队列发送消息单元的频率,确定所述源进程单元的第一当前时间段对应的进程封装包的尺度,所述消息单元中包含至少一个消息;
封装模块,用于根据所述第一当前时间段对应的进程封装包的尺度,对所述源进程单元的发送队列中的消息单元进行封装处理,生成进程封装包;
发送模块,用于发送所述进程封装包。
作为一种可实现方式,所述进程封装包包括:第一进程封装包;
所述封装模块具体用于若所述源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量大于等于所述第一当前时间段对应的进程封装包的尺度,则按照所述第一当前时间段对应的进程封装包的尺度,对所述目的进程单元为同一进程单元的消息单元进行封装处理,生成第一进程封装包,其中,所述第一进程封装包中包含的消息单元的数量与所述第一当前时间段对应的进程封装包的尺度相同。
作为一种可实现方式,所述进程封装包还包括:第二进程封装包;
所述封装模块还具体用于若所述源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量小于所述第一当前时间段对应的进程封装包的尺度,则确定所述目的进程单元为同一进程单元的消息单元中最早进入所述发送队列的消息单元的第一等待时间是否大于等于第一预设定时时间,若所述第一等待时间大于等于所述第一预设定时时间,则对所述目的进程单元为同一进程单元的消息单元进行封装处理,生成第二进
程封装包,所述第二进程封装包中包含所述发送队列中目的进程单元为同一进程单元的所有消息单元。
作为一种可实现方式,所述处理模块具体用于
获取所述第一历史时间段内,通过所述第一进程封装包和所述第二进程封装包发送的消息单元的第一数量;以及,获取所述第一历史时间段内,通过所述第二进程封装包发送的消息单元的第二数量;根据所述第二数量和所述第一数量的比值以及所述第一历史时间段对应的进程封装包的尺度,确定所述第一当前时间段对应的进程封装包的尺度。
作为一种可实现方式,所述处理模块具体用于若所述比值大于第一预设阈值,则确定所述第一当前时间段对应的进程封装包的尺度为所述第一历史时间段对应的进程封装包的尺度与第一系数的乘积,其中,所述第一系数小于1。
作为一种可实现方式,所述处理模块还具体用于若所述比值小于等于所述第一预设阈值,则确定所述第一当前时间段对应的进程封装包的尺度为所述第一历史时间段对应的进程封装包的尺度与第二系数的乘积,其中,所述第二系数大于1。
作为一种可实现方式,所述处理模块还用于确定所述第一数量与第三数量的比值为所述第二系数,其中,所述第三数量为所述第一历史时间段的前一时间段通过所述第一进程封装包和所述第二进程封装包发送的消息单元的数量。
作为一种可实现方式,所述第一预设阈值为0.5。
又一方面,本申请提供一种消息传输装置,包括:
处理器,用于根据第一历史时间段源进程单元的线程单元向所述源进程单元的发送队列发送消息单元的频率,确定所述源进程单元的第一当前时间段对应的进程封装包的尺度,所述消息单元中包含至少一个消息;
所述处理器还用于根据所述第一当前时间段对应的进程封装包的尺度,对所述源进程单元的发送队列中的消息单元进行封装处理,生成进程封装包;
发送器,所述发送器耦合至所述处理器,所述发送器用于发送所述进程封装包。
作为一种可实现方式,所述进程封装包包括:第一进程封装包;
所述处理器具体用于若所述源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量大于等于所述第一当前时间段对应的进程封装包的尺度,则按照所述第一当前时间段对应的进程封装包的尺度,对所述目的进程单元为同一进程单元的消息单元进行封装处理,生成第一进程封装包,其中,所述第一进程封装包中包含的消息单元的数量与所述第一当前时间段对应的进程封装包的尺度相同。
作为一种可实现方式,所述进程封装包还包括:第二进程封装包;
所述处理器还具体用于若所述源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量小于所述第一当前时间段对应的进程封装包的尺度,则确定所述目的进程单元为同一进程单元的消息单元中最早进入所述发送队列的消息单元的第一等待时间是否大于等于第一预设定时时间,若所述第一等待时间大于等于所述第一预设定时时间,则对所述目的进程单元为同一进程单元的消息单元进行封装处理,生成第二进程封装包,所述第二进程封装包中包含所述发送队列中目的进程单元为同一进程单元的所有消息单元。
作为一种可实现方式,所述处理器具体用于
获取所述第一历史时间段内,通过所述第一进程封装包和所述第二进程封装包发送的消息单元的第一数量;以及,获取所述第一历史时间段内,通过所述第二进程封装包发送的消息单元的第二数量;根据所述第二数量和所述第一数量的比值以及所述第一历史时间段对应的进程封装包的尺度,确定所述第一当前时间段对应的进程封装包的尺度。
作为一种可实现方式,所述处理器具体用于若所述比值大于第一预设阈值,则确定所述第一当前时间段对应的进程封装包的尺度为所述第一历史时间段对应的进程封装包的尺度与第一系数的乘积,其中,所述第一系数小于1。
作为一种可实现方式,所述处理器还具体用于若所述比值小于等于所述第一预设阈值,则确定所述第一当前时间段对应的进程封装包的尺度为所述第一历史时间段对应的进程封装包的尺度与第二系数的乘积,其中,所述第二系数大于1。
作为一种可实现方式,所述处理器还用于确定所述第一数量与第三数量的比值为所述第二系数,其中,所述第三数量为所述第一历史时间段的前一时间段通过所述第一进程封装包和所述第二进程封装包发送的消息单元的数量。
作为一种可实现方式,所述第一预设阈值为0.5。
又一方面,本申请提供一种消息传输系统,包括:
源进程单元,所述源进程单元包括至少一个线程单元;
所述线程单元,用于对所述线程单元产生的消息进行封装处理,生成消息单元,所述消息单元中包含至少两个消息;
所述线程单元,还用于向所述源进程单元的发送队列发送所述消息单元。
作为一种可实现方式,所述线程单元具体用于根据第二当前时间段对应的线程封装包的尺度,对所述线程单元产生的消息进行封装处理,生成所述消息单元;
作为一种可实现方式,所述线程单元还用于根据第二历史时间段内所述线程单元产生的消息的数量,确定所述第二当前时间段对应的线程封装包的尺度。
作为一种可实现方式,所述线程单元具体用于若所述线程单元产生的目的线程单元为同一线程单元的消息的数量大于等于所述第二当前时间段对应的线程封装包的尺度,则按照所述线程封装包的尺度,对所述目的线程单元为同一线程单元的消息进行封装处理,生成第一消息单元,其中,所述第一消息单元中包含的消息的数量与所述线程封装包的尺度相同。
作为一种可实现方式,所述线程单元还具体用于若所述线程单元产生的目的线程单元为同一线程单元的消息的数量小于所述第二当前时间段对应的线程封装包的尺度,则确定所述目的线程单元为同一线程单元的消息中最早产生的消息的第二等待时间是否大于等于第二预设定时时间,若所述第二等待时间大于等于所述第二预设定时时间,则对所述目的线程单元为同一线程单元的消息进行封装处理,生成第二消息单元,其中,所述第二消息单元中包含所述线程单元产生的目的线程单元为同一线程单元的所有消息。
作为一种可实现方式,所述线程单元具体用于获取所述第二历史时间段内,通过所述第一消息单元和所述第二消息单元发送的消息的第三数量;以及,获取所述第二历史时间段内,通过所述第二消息单元发送的消息的第四数量;根据所述第四数量和所述第三数量的比值以及所述第二历史时间段对应的线程封装包的尺度,确定所述第二当前时间段对应的线程封装包的尺度。
又一方面,本申请提供一种消息传输方法,包括:
对线程单元产生的消息进行封装处理,生成消息单元,所述消息单元包含至少两个消息;
向所述源进程单元的发送队列发送所述消息单元。
作为一种可实现方式,所述对线程单元产生的消息进行封装处理包括:
根据第二当前时间段对应的线程封装包的尺度,对线程单元产生的消息进行封装处理,生成所述消息单元。
作为一种可实现方式,所述根据第二当前时间段对应的线程封装包的尺度,对线程单元产生的消息进行封装处理,生成所述消息单元之前,还包括:
根据第二历史时间段内所述线程单元产生的消息的数量,确定所述第二当前时间段对应的线程封装包的尺度。
作为一种可实现方式,所述消息单元包括第一消息单元;
所述根据第二当前时间段对应的线程封装包的尺度,对线程单元产生的消息进行封装处理,生成所述消息单元,包括:
若所述线程单元产生的目的线程单元为同一线程单元的消息的数量大于等于所述第二当前时间段对应的线程封装包的尺度,则按照所述线程封装包的尺度,对所述目的线程单元为同一线程单元的消息进行封装处理,生成第一消息单元,其中,所述第一消息单元中包含的消息的数量与所述线程封装包的尺度相同。
作为一种可实现方式,所述消息单元还包括第二消息单元;
所述方法还包括:
若所述线程单元产生的目的线程单元为同一线程单元的消息的数量小于所述第二当前时间段对应的线程封装包的尺度,则确定所述目的线程单元为同一线程单元的消息中最早产生的消息的第二等待时间是否大于等于第二预设定时时间,若所述第二等待时间大于等于所述第二预设定时时间,则对所述目的线程单元为同一线程单元的消息进行封装处理,生成第二消息单元,其中,所述第二消息单元中包含所述线程单元产生的目的线程单元为同一线程单元的所有消息。
作为一种可实现方式,所述根据第二历史时间段内所述线程单元产生的消息的数量,确定所述第二当前时间段对应的线程封装包的尺度,包括:
获取所述第二历史时间段内,通过所述第一消息单元和所述第二消息单元发送的消息的第三数量;以及,
获取所述第二历史时间段内,通过所述第二消息单元发送的消息的第四数量;
根据所述第四数量和所述第三数量的比值以及所述第二历史时间段对应的线程封装包的尺度,确定所述第二当前时间段对应的线程封装包的尺度。
作为一种可实现方式,所述根据所述第四数量和所述第三数量的比值以及所述第二历史时间段对应的线程封装包的尺度,确定所述第二当前时间段对应的线程封装包的尺度,包括:
若所述比值大于第二预设阈值,则确定所述第二当前时间段对应的线程封装包的尺度为所述第二历史时间段对应的线程封装包的尺度与第三系数的乘积,其中,所述第三系数小于1。
作为一种可实现方式,还包括:
若所述比值小于等于所述第二预设阈值,则确定所述第二当前时间段对应的线程封装包的尺度为所述第二历史时间段对应的线程封装包的尺度与第四系数的乘积,其中,
所述第四系数大于1。
作为一种可实现方式,所述第二预设阈值为0.5。
作为一种可实现方式,所述根据第二当前时间段对应的线程封装包的尺度,对线程单元产生的消息进行封装处理,生成所述消息单元之前,还包括:
确定所述线程单元产生的消息的目的线程单元不属于所述源进程单元。
又一方面,本申请提供一种消息传输装置,包括:
封装模块,用于对线程单元产生的消息进行封装处理,生成消息单元,所述消息单元包含至少两个消息;
发送模块,用于向所述源进程单元的发送队列发送所述消息单元。
作为一种可实现方式,所述封装模块具体用于根据第二当前时间段对应的线程封装包的尺度,对线程单元产生的消息进行封装处理,生成所述消息单元。
作为一种可实现方式,还包括:
处理模块,用于根据第二历史时间段内所述线程单元产生的消息的数量,确定所述第二当前时间段对应的线程封装包的尺度。
作为一种可实现方式,所述消息单元包括第一消息单元;
所述封装模块具体用于若所述线程单元产生的目的线程单元为同一线程单元的消息的数量大于等于所述第二当前时间段对应的线程封装包的尺度,则按照所述线程封装包的尺度,对所述目的线程单元为同一线程单元的消息进行封装处理,生成第一消息单元,其中,所述第一消息单元中包含的消息的数量与所述线程封装包的尺度相同。
作为一种可实现方式,所述消息单元还包括第二消息单元;
所述封装模块还具体用于若所述线程单元产生的目的线程单元为同一线程单元的消息的数量小于所述第二当前时间段对应的线程封装包的尺度,则确定所述目的线程单元为同一线程单元的消息中最早产生的消息的第二等待时间是否大于等于第二预设定时时间,若所述第二等待时间大于等于所述第二预设定时时间,则对所述目的线程单元为同一线程单元的消息进行封装处理,生成第二消息单元,其中,所述第二消息单元中包含所述线程单元产生的目的线程单元为同一线程单元的所有消息。
作为一种可实现方式,所述处理模块具体用于获取所述第二历史时间段内,通过所述第一消息单元和所述第二消息单元发送的消息的第三数量;以及,获取所述第二历史时间段内,通过所述第二消息单元发送的消息的第四数量;根据所述第四数量和所述第三数量的比值以及所述第二历史时间段对应的线程封装包的尺度,确定所述第二当前时
间段对应的线程封装包的尺度。
作为一种可实现方式,所述处理模块具体用于若所述比值大于第二预设阈值,则确定所述第二当前时间段对应的线程封装包的尺度为所述第二历史时间段对应的线程封装包的尺度与第三系数的乘积,其中,所述第三系数小于1。
作为一种可实现方式,所述处理模块还具体用于若所述比值小于等于所述第二预设阈值,则确定所述第二当前时间段对应的线程封装包的尺度为所述第二历史时间段对应的线程封装包的尺度与第四系数的乘积,其中,所述第四系数大于1。
作为一种可实现方式,所述第二预设阈值为0.5。
作为一种可实现方式,所述处理模块还具体用于确定所述线程单元产生的消息的目的线程单元不属于所述源进程单元。
又一方面,本申请提供一种消息传输装置,包括:
处理器,用于对线程单元产生的消息进行封装处理,生成消息单元,所述消息单元包含至少两个消息;
发送器,所述发送器耦合至所述处理器,所述发送器用于向所述源进程单元的发送队列发送所述消息单元。
作为一种可实现方式,所述处理器具体用于根据第二当前时间段对应的线程封装包的尺度,对线程单元产生的消息进行封装处理,生成所述消息单元。
作为一种可实现方式,所述处理器还用于根据第二历史时间段内所述线程单元产生的消息的数量,确定所述第二当前时间段对应的线程封装包的尺度。
作为一种可实现方式,所述消息单元包括第一消息单元;
所述处理器具体用于若所述线程单元产生的目的线程单元为同一线程单元的消息的数量大于等于所述第二当前时间段对应的线程封装包的尺度,则按照所述线程封装包的尺度,对所述目的线程单元为同一线程单元的消息进行封装处理,生成第一消息单元,其中,所述第一消息单元中包含的消息的数量与所述线程封装包的尺度相同。
作为一种可实现方式,所述消息单元还包括第二消息单元;
所述处理器还具体用于若所述线程单元产生的目的线程单元为同一线程单元的消息的数量小于所述第二当前时间段对应的线程封装包的尺度,则确定所述目的线程单元为同一线程单元的消息中最早产生的消息的第二等待时间是否大于等于第二预设定时时间,若所述第二等待时间大于等于所述第二预设定时时间,则对所述目的线程单元为同一线程单元的消息进行封装处理,生成第二消息单元,其中,所述第二消息单元中包含
所述线程单元产生的目的线程单元为同一线程单元的所有消息。
作为一种可实现方式,所述处理器具体用于获取所述第二历史时间段内,通过所述第一消息单元和所述第二消息单元发送的消息的第三数量;以及,获取所述第二历史时间段内,通过所述第二消息单元发送的消息的第四数量;根据所述第四数量和所述第三数量的比值以及所述第二历史时间段对应的线程封装包的尺度,确定所述第二当前时间段对应的线程封装包的尺度。
作为一种可实现方式,所述处理器具体用于若所述比值大于第二预设阈值,则确定所述第二当前时间段对应的线程封装包的尺度为所述第二历史时间段对应的线程封装包的尺度与第三系数的乘积,其中,所述第三系数小于1。
作为一种可实现方式,所述处理器还具体用于若所述比值小于等于所述第二预设阈值,则确定所述第二当前时间段对应的线程封装包的尺度为所述第二历史时间段对应的线程封装包的尺度与第四系数的乘积,其中,所述第四系数大于1。
作为一种可实现方式,所述第二预设阈值为0.5。
作为一种可实现方式,所述处理器还具体用于确定所述线程单元产生的消息的目的线程单元不属于所述源进程单元。
又一方面,本申请提供一种消息传输系统,包括:
进程单元,所述进程单元包括源线程单元和目的线程单元;
所述源线程单元,用于确定所述源线程单元产生的消息的目的线程单元是否属于同一进程单元;
所述源线程单元,还用于若所述消息的目的线程单元属于同一进程单元,则向所述目的线程单元的接收队列发送所述消息。
又一方面,本申请提供一种消息传输方法,包括:
确定产生的消息的目的线程单元是否与源线程单元属于同一进程单元;
若所述消息的目的线程单元与源线程单元属于同一进程单元,则向所述目的线程单元的接收队列发送所述消息。
又一方面,本申请提供一种消息传输装置,包括:
处理模块,用于确定产生的消息的目的线程单元是否与源线程单元属于同一进程单元;
发送模块,用于若所述消息的目的线程单元与源线程单元属于同一进程单元,则向所述目的线程单元的接收队列发送所述消息。
又一方面,本申请提供一种消息传输装置,包括:
处理器和发送器,所述处理器用于确定产生的消息的目的线程单元是否与源线程单元属于同一进程单元;
所述发送器耦合至所述处理器,所述发送器用于若所述消息的目的线程单元与源线程单元属于同一进程单元,则向所述目的线程单元的接收队列发送所述消息。
本申请提供的消息传输系统、方法和装置,通过根据第一历史时间段源进程单元的线程单元向源进程单元的发送队列发送消息单元的频率,确定源进程单元的第一当前时间段对应的进程封装包的尺度,根据第一当前时间段对应的进程封装包的尺度,对源进程单元的发送队列中的消息单元进行封装处理,生成进程封装包,发送进程封装包,实现消息传输,提高网络资源的利用率,以及提高传输效率。
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本申请的一种应用场景示意图;
图2为本申请消息传输系统实施例一的结构示意图;
图3为本申请消息传输方法实施例一的流程示意图;
图4为本申请消息传输方法实施例二的流程示意图;
图5为本申请消息传输方法实施例三的流程示意图;
图6为本申请消息传输装置实施例一的结构示意图;
图7为本申请消息传输装置实施例二的结构示意图;
图8为本申请消息传输系统实施例二的结构示意图;
图9为本申请消息传输方法实施例四的流程示意图;
图10为本申请消息传输方法实施例五的流程示意图;
图11为本申请消息传输方法实施例六的流程示意图;
图12为本申请消息传输方法实施例七的流程示意图;
图13为本申请消息传输装置实施例三的结构示意图;
图14为本申请消息传输装置实施例四的结构示意图;
图15为本申请消息传输系统实施例三的结构示意图;
图16为本申请消息传输方法实施例八的流程示意图;
图17为本申请消息传输装置实施例五的结构示意图;
图18为本申请消息传输装置实施例六的结构示意图。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本发明相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本发明的一些方面相一致的装置和方法的例子。
应当明确,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。
在本发明实施例中使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本发明。在本发明实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。
应当理解,本文中使用的术语“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。
应当理解,尽管在本发明实施例中可能采用术语第一、第二、第三等来描述XXX,但这些XXX不应限于这些术语。这些术语仅用来将XXX彼此区分开。例如,在不脱离本发明实施例范围的情况下,第一XXX也可以被称为第二XXX,类似地,第二XXX也可以被称为第一XXX。
取决于语境,如在此所使用的词语“如果”、“若”可以被解释成为“在……时”或“当……时”或“响应于确定”或“响应于检测”。类似地,取决于语境,短语“如
果确定”或“如果检测(陈述的条件或事件)”可以被解释成为“当确定时”或“响应于确定”或“当检测(陈述的条件或事件)时”或“响应于检测(陈述的条件或事件)”。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的商品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种商品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的商品或者系统中还存在另外的相同要素。
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本发明相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本发明的一些方面相一致的装置和方法的例子。
本申请应用于不同的线程单元之间进行消息传输的场景,其中,包括同一进程单元的不同线程单元之间进行消息传输,以及不同进程单元的线程单元之间进行消息传输,图1为本申请的一种应用场景示意图,该应用场景中包含进程单元A和进程单元B,其中,进程单元A包含线程单元A1、线程单元A2和线程单元A3,进程单元B包含线程单元B1、线程单元B2和线程单元B3,各线程单元之间可以进行消息传输,例如:一种情况为:进程单元A的线程单元A1和进程单元B的线程单元B2之间进行消息传输,另一种情况为进程单元A的线程单元A1和进程单元A的线程单元A2之间进行消息传输。
本申请所描述的消息单元中可以包含一条消息或者多条消息,取决于线程单元在向源进程单元发送消息之前,是否对消息进行了封装处理,若线程单元在发送消息之前,对消息进行了封装处理,则消息单元中通常包含两条或两条以上的消息,若线程单元在发送消息之前,未对消息进行封装处理,则消息单元指一条消息。
本申请所描述的进程封装包是指进程单元进行封装处理之后产生的封装包。
为了便于描述,本申请将发送端的源进程单元进行封装处理过程中所用的参数,与源进程单元的线程单元进行封装处理过程中所用的参数通过在第一、第二进行区分。
例如:源进程单元进行封装处理过程中所用的参数包括:
第一历史时间段、第一当前时间段、第一等待时间和/或第一预预设定时时间等。
线程单元进行封装处理过程中所用的参数包括:
第二历史时间段、第二当前时间段、第二等待时间和/或第二预预设定时时间等。
本申请包括但不限于以下主要的改进点:
1、源进程单元对发送队列中消息进行封装处理时,所采用的进程封装包的尺度不是固定的,而是根据第一历史时间段内源进程单元的线程单元向源进程单元的发送队列发送消息单元的频率确定,从而,使得进程封装包的尺度的设置更加合理,避免因进程封装包的尺度设置过大时,网络通道空闲时间长,以及避免因进程封装包的尺寸设置过小时,造成网络通道的带宽浪费,并且,进行封装处理的次数较多,造成一定的延时,因此,本申请根据历史时间段内源进程单元的线程单元向源进程单元的发送队列发送消息单元的频率确定进程封装包的尺度更加合理,可以提高网络资源的利用率,以及提高传输效率。
2、源进程单元对发送队列中消息进行封装处理时,除了依据进程封装包的尺度进行封装处理外,还设置第一预设定时时间,若源进程单元的发送队列中目的进程单元为同一进程单元的消息单元中最早进入发送队列的消息单元的第一等待时间大于等于第一预设定时时间,则对目的进程单元为同一进程单元的消息单元进行封装处理,从而,避免因源进程单元的线程单元发送消息单元的频率不稳定时,因消息单元数量较长时间不能满足进程封装包的尺度而无法进行封装处理,导致消息发送时延较长的问题。
3、源进程单元的线程单元向源进程单元的发送队列发送消息单元前,也可以对消息进行封装处理。进行封装处理时,线程封装包的尺度可以是固定的,也可以是根据第二历史时间段内产生的消息的数量确定的,对此,本发明不做限制。
4、源进程单元的线程单元对产生的消息进行封装处理时,除了依据线程封装包的尺度进行封装处理外,还设置第二预设定时时间,当目的线程单元为同一线程单元的消息中最早产生的消息的等待时间大于等于第二预设定时时间,则对目的线程单元为同一线程单元的消息进行封装处理。
5、源进程单元的线程单元对产生的消息进行封装处理之前,确定消息的目的线程单元是否属于源进程单元,若消息的目的进程单元不属于源进程单元,则对消息进行封装处理,生成消息单元发送到源进程单元的发送队列,若消息的目的进程单元属于源进程单元,则直接发送到目的线程单元的接收队列,即,无需先将消息发送到进程单元的发送队列,再通过网络通道发送到该进程单元的接收队列,再发送到目的线程单元,从而,缩短消息发送的时延,提高消息传输效率。
下面以具体地实施例对本申请的技术方案进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例不再赘述。
图2为本申请消息传输系统实施例一的结构示意图,如图2所示,本实施例的系统包括元进程单元和目的进程单元,其中,源进程单元包含至少一个线程单元,源进程单元和目的进程单元连接;在图2中,源进程单元以进程A为例示出,目的进程单元以进程B示出,源进程单元包含至少一个线程单元以3个线程单元为例示出,分别为线程单元A1、线程单元A2和线程单元A3;线程B中也可以包含至少一个线程单元,以线程单元B1、线程单元B2和线程单元B3示出。
其中,源进程单元根据第一历史时间段至少一个线程单元向源进程单元的发送队列发送消息单元的频率,确定源进程单元的第一当前时间段对应的进程封装包的尺度,消息单元中包含至少一个消息;并根据第一当前时间段对应的进程封装包的尺度,对源进程单元的发送队列中的消息单元进行封装处理,生成进程封装包;生成进程封装包之后向目的进程单元发送进程封装包。
在上述实施例中,源进程单元根据第一历史时间段至少一个线程单元向源进程单元的发送队列发送消息单元的频率时,具体为:若源进程单元的发送队列中目的进程单元为目的进程单元的消息单元的数量大于等于第一当前时间段对应的进程封装包的尺度,源进程单元则按照第一当前时间段对应的进程封装包的尺度,对目的进程单元为目的进程单元的消息单元进行封装处理,生成第一进程封装包,其中,第一进程封装包中包含的消息单元的数量与第一当前时间段对应的进程封装包的尺度相同。
在上述实施例中,源进程单元根据第一历史时间段至少一个线程单元向源进程单元的发送队列发送消息单元的频率时,还包括:若源进程单元的发送队列中目的进程单元为目的进程单元的消息单元的数量小于第一当前时间段对应的进程封装包的尺度,源进程单元则确定目的进程单元为目的进程单元的消息单元中最早进入发送队列的消息单元的第一等待时间是否大于等于第一预设定时时间,若第一等待时间大于等于第一预设定时时间,则对目的进程单元为目的进程单元的消息单元进行封装处理,生成第二进程封装包,第二进程封装包中包含发送队列中目的进程单元为目的进程单元的所有消息单元。
在上述实施例中,源进程单元根据第一历史时间段至少一个线程单元向源进程单元的发送队列发送消息单元的频率,确定源进程单元的第一当前时间段对应的进程封装包
的尺度时,具体为:源进程单元获取第一历史时间段内,通过第一进程封装包和第二进程封装包发送的消息单元的第一数量;以及,获取第一历史时间段内,通过第二进程封装包发送的消息单元的第二数量;根据第二数量和第一数量的比值以及第一历史时间段对应的进程封装包的尺度,确定第一当前时间段对应的进程封装包的尺度。
图2所示消息传输系统实施例中源进程单元具体可用于执行图3-图5所示方法实施例的技术方案,其实现原理和技术效果,参见图3-图5所示方法实施例中的详细描述,此处不再赘述。
图3为本申请消息传输方法实施例一的流程示意图,如图2所示,本实施例由发送端执行,具体地,S301-303由发送端的源进程单元执行,本实施例的方法如下:
S301:根据第一历史时间段源进程单元的线程单元向源进程单元的发送队列发送消息单元的频率,确定源进程单元的第一当前时间段对应的进程封装包的尺度。
其中,消息单元中包含至少一个消息。
第一当前时间段是指要对源进程单元的发送队列中的消息单元进行封装处理;第一历史时间段是指第一当前时间段之前的时间段。
即:根据之前时间段的源进程单元的线程单元向源进程单元的发送队列发送消息单元的频率,可以更加合理的预估当前时间段源进程单元的线程单元向源进程单元的发送队列发送消息单元的频率,因此,基于第一历史时间段源进程单元的线程单元向源进程单元的发送队列发送消息单元的频率,确定源进程单元的第一当前时间段对应的进程封装包的尺度,所确定的进程封装包的尺度更加合理。当第一历史时间段源进程单元的线程单元向源进程单元的发送队列发送消息单元的频率发送变化后,第一当前时间段对应的进程封装包的尺度也会相应的发生变化,即,第一当前时间段对应的进程封装包的尺度会随时第一历史时间段源进程单元的线程单元向源进程单元的发送队列发送消息单元的频率的变化而变化,从而,使得进程封装包的尺度设置更加合理。
S302:根据第一当前时间段对应的进程封装包的尺度,对源进程单元的发送队列中的消息单元进行封装处理,生成进程封装包。
例如:第一当前时间段对应的进程封装包的尺度为3个消息单元,则获取对源进程单元的发送队列中目的进程单元为同一进程单元的3个消息单元,进行封装处理,生成进程单元包。
S303:发送进程封装包。
将进行封装包通过进程单元之间的网络通道发送到目的进程单元,以使目的进程单元进行相应地解封装处理,发送到对应的目的线程单元,完成消息传输。
本实施例,通过根据第一历史时间段源进程单元的线程单元向源进程单元的发送队列发送消息单元的频率,确定源进程单元的第一当前时间段对应的进程封装包的尺度,根据第一当前时间段对应的进程封装包的尺度,对源进程单元的发送队列中的消息单元进行封装处理,生成进程封装包,发送进程封装包,实现消息传输,由于进程封装包的尺度是根据第一历史时间段内源进程单元的线程单元向源进程单元的发送队列发送消息单元的频率确定,从而,使得进程封装包的尺度的设置更加合理,避免因进程封装包的尺度设置过大时,网络通道空闲时间长,以及避免因进程封装包的尺寸设置过小时,造成网络通道的带宽浪费,并且,进行封装处理的次数较多,造成一定的延时,因此,本申请根据历史时间段内源进程单元的线程单元向源进程单元的发送队列发送消息单元的频率确定进程封装包的尺度更加合理,可以提高网络资源的利用率,以及提高传输效率。
图4为本申请消息传输方法实施例二的流程示意图,本实施例是在图3所示实施例的基础上,进一步地,对S302的可能的实现方式的描述,其中,可以通过两种方式触发进程单元进行封装处理,其中,第一种方式为:源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量大于等于第一当前时间段对应的进程封装包的尺度,则触发进程单元进行封装处理。第二种方式为:源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量小于第一当前时间段对应的进程封装包的尺度,但目的进程单元为同一进程单元的消息单元中最早进入发送队列的消息单元的第一等待时间大于等于第一预设定时时间,则触发进程单元进行消息封装处理。为了便于描述,将通过第一种方式触发进行封装处理产生的进程封装包描述为“第一进程封装包”,将通过第二种方式触发进行封装处理产生的进程封装包描述为“第二进程封装包”,如图4所示,本实施例如下:
S401:判断源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量是否大于等于第一当前时间段对应的进程封装包的尺度。
若源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量大于等于第一当前时间段对应的进程封装包的尺度,则执行S402。
若源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量小于第一当前时间段对应的进程封装包的尺度,则执行S403。
S402:按照第一当前时间段对应的进程封装包的尺度,对目的进程单元为同一进程单元的消息单元进行封装处理,生成第一进程封装包。
其中,第一进程封装包中包含的消息单元的数量与第一当前时间段对应的进程封装包的尺度相同。
即:通过第一种方式触发进程单元进行封装处理。
S403:确定目的进程单元为同一进程单元的消息单元中最早进入发送队列的消息单元的第一等待时间是否大于等于第一预设定时时间。
若第一等待时间大于等于第一预设定时时间,则执行S404。
若第一等待时间小于第一预设定时时间,则返回执行S401。
其中,第一预设定时时间可以根据经验值进行设置。第一等待时间由专门的线程单元(描述为定时线程单元)进行监控,当第一等待时间大于等于第一预设定时时间时,该定时线程单元向源进程单元发送指示消息,触发源进程单元进行封装处理。
S404:对目的进程单元为同一进程单元的消息单元进行封装处理,生成第二进程封装包。
其中,第二进程封装包中包含发送队列中目的进程单元为同一进程单元的所有消息单元。
即:通过第二种方式触发进行封装处理。
本实施例,通过两种方式触发进程单元进行封装处理,当源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量大于等于第一当前时间段对应的进程封装包的尺度,则触发按照第一当前时间段对应的进程封装包的尺度,对目的进程单元为同一进程单元的消息单元进行封装处理;当源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量小于第一当前时间段对应的进程封装包的尺度了,但目的进程单元为同一进程单元的消息单元中最早进入发送队列的消息单元的第一等待时间大于等于第一预设定时时间,则触发进行消息封装处理。从而,避免因源进程单元的线程单元发送消息单元的频率不稳定时,因消息单元数量较长时间不能满足进程封装包的尺度而无法进行封装处理,导致消息发送时延较长的问题。
图5为本申请消息传输方法实施例三的流程示意图,本实施例是在实施例二所示实施例的基础上,对S301的一种可能的实现的方式的描述,如图5所示:
S501:获取第一历史时间段内,通过第一进程封装包和第二进程封装包发送的消息
单元的第一数量。
S502:获取第一历史时间段内,通过第二进程封装包发送的消息单元的第二数量。
其中,S501和S502的执行顺序不做限制。
S503:根据第二数量和第一数量的比值以及第一历史时间段对应的进程封装包的尺度,确定第一当前时间段对应的进程封装包的尺度。
通过第二数量和第一数量的比值,可以获知第一历史时间段源进程单元的线程单元向源进程单元的发送队列发送消息单元的频率的变化趋势,第一预设阈值通常设置为0.5,若比值大于第一预设阈值,说明线程单元向源进程单元的发送队列发送消息单元的频率变慢,大多数的消息是通过第二种方式触发进行封装处理的,因此,要减小进程封装包的尺度。若比值大于0.5,说明线程单元向源进程单元的发送队列发送消息单元的频率变快,大多数的消息是通过第一种方式触发进行封装处理的,因此,要增大进程封装包的尺度。
当要缩小进程封装包的尺度时,要确保第一历史时间段对应的进程封装包的尺度大于1。
具体地,包括但不限于以下两种可能的实现方式:
一种可能的实现方式:
若比值大于第一预设阈值,则确定第一当前时间段对应的进程封装包的尺度为第一历史时间段对应的进程封装包的尺度与第一系数的乘积,其中,第一系数小于1。即使第一当前时间段对应的进程封装包的尺度小于第一历史时间段对应的进程封装包的尺度。
另一种可能的实现方式:
若比值小于等于第一预设阈值,则确定第一当前时间段对应的进程封装包的尺度为第一历史时间段对应的进程封装包的尺度与第二系数的乘积,其中,第二系数大于1。即使第一当前时间段对应的进程封装包的尺度小大于第一历史时间段对应的进程封装包的尺度。
其中,第二系数的一种可能的获取方式为:
确定第一数量与第三数量的比值为第二系数,其中,第三数量为第一历史时间段的前一时间段通过第一进程封装包和第二进程封装包发送的消息单元的数量。
本实施例,通过获取第一历史时间段内,通过第一进程封装包和第二进程封装包发送的消息单元的第一数量,以及获取第一历史时间段内,通过第二进程封装包发送的消
息单元的第二数量,根据第二数量和第一数量的比值以及第一历史时间段对应的进程封装包的尺度,确定第一当前时间段对应的进程封装包的尺度。从而,使得进程封装包的尺度设置的更加合理。
图6为本申请消息传输装置实施例一的结构示意图,本实施例的装置包括处理模块601、封装模块602和发送模块603,其中,处理模块601用于根据第一历史时间段源进程单元的线程单元向源进程单元的发送队列发送消息单元的频率,确定源进程单元的第一当前时间段对应的进程封装包的尺度,消息单元中包含至少一个消息;封装模块602用于根据第一当前时间段对应的进程封装包的尺度,对源进程单元的发送队列中的消息单元进行封装处理,生成进程封装包;发送模块603用于发送进程封装包。
本实施例的装置,对应的可用于执行消息传输方法实施例一所示的技术方案,其实现原理和技术效果类似,此处不再赘述。
在图6中,进程封装包包括:第一进程封装包;
封装模块602具体用于若源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量大于等于第一当前时间段对应的进程封装包的尺度,则按照第一当前时间段对应的进程封装包的尺度,对目的进程单元为同一进程单元的消息单元进行封装处理,生成第一进程封装包,其中,第一进程封装包中包含的消息单元的数量与第一当前时间段对应的进程封装包的尺度相同。
在图6中,进程封装包还包括:第二进程封装包;
封装模块602还具体用于若源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量小于第一当前时间段对应的进程封装包的尺度,则确定目的进程单元为同一进程单元的消息单元中最早进入发送队列的消息单元的第一等待时间是否大于等于第一预设定时时间,若第一等待时间大于等于第一预设定时时间,则对目的进程单元为同一进程单元的消息单元进行封装处理,生成第二进程封装包,第二进程封装包中包含发送队列中目的进程单元为同一进程单元的所有消息单元。
本实施例的装置,对应的可用于执行消息传输方法实施例二所示的技术方案,其实现原理和技术效果类似,此处不再赘述。
在图6中处理模块601具体用于获取第一历史时间段内,通过第一进程封装包和第二进程封装包发送的消息单元的第一数量;以及,获取第一历史时间段内,通过第二进
程封装包发送的消息单元的第二数量;根据第二数量和第一数量的比值以及第一历史时间段对应的进程封装包的尺度,确定第一当前时间段对应的进程封装包的尺度。
其中,处理模块601具体用于若比值大于第一预设阈值,则确定第一当前时间段对应的进程封装包的尺度为第一历史时间段对应的进程封装包的尺度与第一系数的乘积,其中,第一系数小于1。
其中,处理模块601还具体用于若比值小于等于第一预设阈值,则确定第一当前时间段对应的进程封装包的尺度为第一历史时间段对应的进程封装包的尺度与第二系数的乘积,其中,第二系数大于1。
其中,处理模块601还用于确定第一数量与第三数量的比值为第二系数,其中,第三数量为第一历史时间段的前一时间段通过第一进程封装包和第二进程封装包发送的消息单元的数量。
本实施例的装置,对应的可用于执行消息传输方法实施例三所示的技术方案,其实现原理和技术效果类似,此处不再赘述。
图7为本申请消息传输装置实施例二的结构示意图,本实施例的装置包括处理器701和发送器702,其中,处理器701用于根据第一历史时间段源进程单元的线程单元向源进程单元的发送队列发送消息单元的频率,确定源进程单元的第一当前时间段对应的进程封装包的尺度,消息单元中包含至少一个消息;处理器701还用于根据第一当前时间段对应的进程封装包的尺度,对源进程单元的发送队列中的消息单元进行封装处理,生成进程封装包;发送器702发送器耦合至处理器,发送器用于发送进程封装包。
本实施例的装置,对应的可用于执行消息传输方法实施例一所示的技术方案,其实现原理和技术效果类似,此处不再赘述。
在图7中,进程封装包包括:第一进程封装包;
处理器701具体用于若源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量大于等于第一当前时间段对应的进程封装包的尺度,则按照第一当前时间段对应的进程封装包的尺度,对目的进程单元为同一进程单元的消息单元进行封装处理,生成第一进程封装包,其中,第一进程封装包中包含的消息单元的数量与第一当前时间段对应的进程封装包的尺度相同。
在图7中,进程封装包还包括:第二进程封装包;
处理器701还具体用于若源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量小于第一当前时间段对应的进程封装包的尺度,则确定目的进程单元为同一进程单元的消息单元中最早进入发送队列的消息单元的第一等待时间是否大于等于第一预设定时时间,若第一等待时间大于等于第一预设定时时间,则对目的进程单元为同一进程单元的消息单元进行封装处理,生成第二进程封装包,第二进程封装包中包含发送队列中目的进程单元为同一进程单元的所有消息单元。
本实施例的装置,对应的可用于执行消息传输方法实施例二所示的技术方案,其实现原理和技术效果类似,此处不再赘述。
在图7中,处理器701具体用于获取第一历史时间段内,通过第一进程封装包和第二进程封装包发送的消息单元的第一数量;以及,获取第一历史时间段内,通过第二进程封装包发送的消息单元的第二数量;根据第二数量和第一数量的比值以及第一历史时间段对应的进程封装包的尺度,确定第一当前时间段对应的进程封装包的尺度。
其中,处理器701具体用于若比值大于第一预设阈值,则确定第一当前时间段对应的进程封装包的尺度为第一历史时间段对应的进程封装包的尺度与第一系数的乘积,其中,第一系数小于1。
其中,处理器701还具体用于若比值小于等于第一预设阈值,则确定第一当前时间段对应的进程封装包的尺度为第一历史时间段对应的进程封装包的尺度与第二系数的乘积,其中,第二系数大于1。
其中,处理器701还用于确定第一数量与第三数量的比值为第二系数,其中,第三数量为第一历史时间段的前一时间段通过第一进程封装包和第二进程封装包发送的消息单元的数量。
本实施例的装置,对应的可用于执行消息传输方法实施例三所示的技术方案,其实现原理和技术效果类似,此处不再赘述。
图8为本申请消息传输系统实施例二的结构示意图,该系统包括源进程单元,源进程单元包括至少一个线程单元,如图8所示,图8中源进程单元以进程单元A示出,至少一个线程单元以线程单元A1、线程单元A2和线程单元A3示出,其中,线程单元对线程单元产生的消息进行封装处理,生成消息单元,消息单元中包含至少两个消息;线程单元向源进程单元的发送队列发送消息单元。
在上述实施例中,线程单元对线程单元产生的消息进行封装处理,生成消息单元,具体为:线程单元根据第二当前时间段对应的线程封装包的尺度,对线程单元产生的消息进行封装处理,生成消息单元;
在上述实施例中,线程单元对线程单元产生的消息进行封装处理,生成消息单元之前,线程单元根据第二历史时间段内线程单元产生的消息的数量,确定第二当前时间段对应的线程封装包的尺度。
在上述实施例中,线程单元根据第二当前时间段对应的线程封装包的尺度,对线程单元产生的消息进行封装处理,生成消息单元时,具体为:
线程单元具体用于若线程单元产生的目的线程单元为同一线程单元的消息的数量大于等于第二当前时间段对应的线程封装包的尺度,则按照线程封装包的尺度,对目的线程单元为同一线程单元的消息进行封装处理,生成第一消息单元,其中,第一消息单元中包含的消息的数量与线程封装包的尺度相同。
在上述实施例中,线程单元根据第二当前时间段对应的线程封装包的尺度,对线程单元产生的消息进行封装处理,生成消息单元时,具体为:
线程单元还具体用于若线程单元产生的目的线程单元为同一线程单元的消息的数量小于第二当前时间段对应的线程封装包的尺度,则确定目的线程单元为同一线程单元的消息中最早产生的消息的第二等待时间是否大于等于第二预设定时时间,若第二等待时间大于等于第二预设定时时间,则对目的线程单元为同一线程单元的消息进行封装处理,生成第二消息单元,其中,第二消息单元中包含线程单元产生的目的线程单元为同一线程单元的所有消息。
在上述实施例中,线程单元根据第二历史时间段内线程单元产生的消息的数量,确定第二当前时间段对应的线程封装包的尺度时,具体为:
线程单元具体用于获取第二历史时间段内,通过第一消息单元和第二消息单元发送的消息的第三数量;以及,获取第二历史时间段内,通过第二消息单元发送的消息的第四数量;根据第四数量和第三数量的比值以及第二历史时间段对应的线程封装包的尺度,确定第二当前时间段对应的线程封装包的尺度。
图8所示消息传输系统实施例中源进程单元具体可用于执行图9-图12所示方法实施例的技术方案,其实现原理和技术效果,参见图9-图12所示方法实施例中的详细描述,此处不再赘述。
图9为本申请消息传输方法实施例四的流程示意图,本实施例由发送端的线程单元执行,本实施例所对应的技术方案可以在独立执行,也可以结合上述各实施例,在上述各实施例的基础执行:如下所示:
S901:对线程单元产生的消息进行封装处理,生成消息单元。
其中,消息单元包含至少两个消息。
其中,对线程单元产生的消息进行封装处理所采用的线程封装包的尺度,可以是固定不变的,也可以是根据第二历史时间段内线程单元产生的消息的数量,动态确定的,对此,本申请不做限制。
S902:向源进程单元的发送队列发送上述消息单元。
本实施例,通过线程单元对线程单元产生的消息进行封装处理,生成消息单元,向源进程单元的发送队列发送消息单元,由于在线程单元处进行封装处理,进一步地,提高消息传输的性能。
实施例五
图10为本申请消息传输方法实施例五的流程示意图,本实施例是在图9所示实施例的基础上,进一步地,在执行S901之前,还包括:
S1000:根据第二历史时间段内线程单元产生的消息的数量,确定第二当前时间段对应的线程封装包的尺度。
本实施例,通过根据第二历史时间段内线程单元产生的消息的数量,确定第二当前时间段对应的线程封装包的尺度,线程封装包的尺度设置更加合理。
实施例六
图11为本申请消息传输方法实施例六的流程示意图,本实施例是在实施例五或实施例六所示实施例的基础上,进一步地,S901的可能的实现的方式的描述,其中,
其中,可以通过两种方式触发线程单元进行封装处理,其中,第一种方式为:线程单元产生的目的线程单元为同一线程单元的消息的数量大于等于第二当前时间段对应的线程封装包的尺度,则触发线程单元进行封装处理。第二种方式为:线程单元产生的目的线程单元为同一线程单元的消息的数量小于第二当前时间段对应的线程封装包的尺度,但目的线程单元为同一线程单元的消息中最早产生的消息的第二等待时间大于等于第二预设定时时间,则触发线程单元进行消息封装处理。为了便于描述,将通过第一种
方式触发线程单元进行封装处理产生的消息单元描述为“第一消息单元”,将通过第二种方式触发线程单元进行封装处理产生的消息单元描述为“第二消息单元”,如图11所示,本实施例如下:
S1101:判断线程单元产生的目的线程单元为同一线程单元的消息的数量是否大于等于第二当前时间段对应的线程封装包的尺度。
若线程单元产生的目的线程单元为同一线程单元的消息的数量大于等于第二当前时间段对应的线程封装包的尺度,则执行S1102。
若线程单元产生的目的线程单元为同一线程单元的消息的数量小于第二当前时间段对应的线程封装包的尺度,则执行S1103。
S1102:按照线程封装包的尺度,对目的线程单元为同一线程单元的消息进行封装处理,生成第一消息单元。
其中,第一消息单元中包含的消息的数量与线程封装包的尺度相同。
即:通过第一种方式触发线程单元进行封装处理。
S1103:确定目的线程单元为同一线程单元的消息中最早产生的消息的第二等待时间是否大于等于第二预设定时时间。
若第二等待时间大于等于第二预设定时时间,则执行S1104。
若第二等待时间小于第二预设定时时间,则返回执行S1101。
其中,第二预设定时时间可以根据经验值进行设置。第二等待时间由专门的线程单元(描述为定时线程单元)进行监控,当第二等待时间大于等于第二预设定时时间时,该定时线程单元向产生消息的线程单元发送指示消息,触发产生消息的线程单元进行封装处理。
S1104:对目的线程单元为同一线程单元的消息进行封装处理,生成第二消息单元。
其中,第二消息单元中包含线程单元产生的目的线程单元为同一线程单元的所有消息。
即:通过第二种方式触发线程单元进行封装处理。
本实施例:通过两种方式触发线程单元进行封装处理,当线程单元产生的目的线程单元为同一线程单元的消息的数量大于等于第二当前时间段对应的线程封装包的尺度,则触发按照线程封装包的尺度,对目的线程单元为同一线程单元的消息进行封装处理,生成第一消息单元;当线程单元产生的目的线程单元为同一线程单元的消息的数量小于第二当前时间段对应的线程封装包的尺度,但目的线程单元为同一线程单元的消息中最
早产生的消息的第二等待时间是否大于等于第二预设定时时间,则触发线程单元对目的线程单元为同一线程单元的消息进行封装处理,生成第二消息单元,从而,避免因线程单元产生消息的频率不稳定时,消息数量较长时间不能满足线程封装包的尺度而无法进行封装处理,导致消息发送时延较长的问题。
实施例七
图12为本申请消息传输方法实施例七的流程示意图,本实施例是在实施例六所示实施例的基础上,进一步地,S1000的一种可能的实现的方式的描述,如图12所示:
S1201:获取第二历史时间段内,通过第一消息单元和第二消息单元发送的消息的第三数量。
S1202:获取第二历史时间段内,通过第二消息单元发送的消息的第四数量。
其中,S1201和S1202的执行顺序不做限制。
S1203:根据第四数量和第三数量的比值以及第二历史时间段对应的线程封装包的尺度,确定第二当前时间段对应的线程封装包的尺度。
通过第四数量和第三数量的比值,可以获知第二历史时间段线程单元产生消息的频率的变化趋势,第二预设阈值通常设置为0.5,若比值大于第二预设阈值,说明线程单元产生消息的频率变慢,大多数的消息是通过第二种方式触发线程单元进行封装处理的,因此,要减小线程封装包的尺度。若比值大于0.5,说明线程单元产生消息的频率变快,大多数的消息是通过第一种方式触发线程单元进行封装处理的,因此,要增大线程封装包的尺度。
当要缩小线程封装包的尺度时,要确保第二历史时间段对应的线程封装包的尺度大于1。
具体地,包括但不限于以下两种可能的实现方式:
一种可能的实现方式:
若比值大于第二预设阈值,则确定第二当前时间段对应的线程封装包的尺度为第二历史时间段对应的线程封装包的尺度与第三系数的乘积,其中,第三系数小于1。即使第二当前时间段对应的线程封装包的尺度小于第二历史时间段对应的进程封装包的尺度。
另一种可能的实现方式:
若比值小于等于第二预设阈值,则确定第二当前时间段对应的线程封装包的尺度为
第二历史时间段对应的线程封装包的尺度与第四系数的乘积,其中,第四系数大于1。即使第二当前时间段对应的进程封装包的尺度小大于第二历史时间段对应的进程封装包的尺度。
本实施例,通过获取第二历史时间段内,通过第一消息单元和第二消息单元发送的消息的第三数量,以及,获取第二历史时间段内,通过第二消息单元发送的消息的第四数量,根据第四数量和第三数量的比值以及第二历史时间段对应的线程封装包的尺度,确定第二当前时间段对应的线程封装包的尺度,从而,使得线程封装包的尺度设置更加合理。
图13为本申请消息传输装置实施例三的结构示意图,本实施例的装置包括封装模块1301、发送模块1302,其中,封装模块1301用于对线程单元产生的消息进行封装处理,生成消息单元,消息单元包含至少两个消息;发送模块1302用于向源进程单元的发送队列发送消息单元。
本实施例的装置,对应的可用于执行消息传输方法实施例四所示的技术方案,其实现原理和技术效果类似,此处不再赘述。
在图13中,封装模块1301具体用于根据第二当前时间段对应的线程封装包的尺度,对线程单元产生的消息进行封装处理,生成消息单元。还包括:处理模块1303用于根据第二历史时间段内线程单元产生的消息的数量,确定第二当前时间段对应的线程封装包的尺度。
本实施例的装置,对应的可用于执行消息传输方法实施例五所示的技术方案,其实现原理和技术效果类似,此处不再赘述。
在图13中,消息单元包括第一消息单元;
封装模块1301具体用于若线程单元产生的目的线程单元为同一线程单元的消息的数量大于等于第二当前时间段对应的线程封装包的尺度,则按照线程封装包的尺度,对目的线程单元为同一线程单元的消息进行封装处理,生成第一消息单元,其中,第一消息单元中包含的消息的数量与线程封装包的尺度相同。
在图13中,消息单元还包括第二消息单元;
封装模块1301还具体用于若线程单元产生的目的线程单元为同一线程单元的消息的数量小于第二当前时间段对应的线程封装包的尺度,则确定目的线程单元为同一线程
单元的消息中最早产生的消息的第二等待时间是否大于等于第二预设定时时间,若第二等待时间大于等于第二预设定时时间,则对目的线程单元为同一线程单元的消息进行封装处理,生成第二消息单元,其中,第二消息单元中包含线程单元产生的目的线程单元为同一线程单元的所有消息。
本实施例的装置,对应的可用于执行消息传输方法实施例六所示的技术方案,其实现原理和技术效果类似,此处不再赘述。
在图13中,处理模块1303具体用于获取第二历史时间段内,通过第一消息单元和第二消息单元发送的消息的第三数量;以及,获取第二历史时间段内,通过第二消息单元发送的消息的第四数量;根据第四数量和第三数量的比值以及第二历史时间段对应的线程封装包的尺度,确定第二当前时间段对应的线程封装包的尺度。
其中,处理模块1303具体用于若比值大于第二预设阈值,则确定第二当前时间段对应的线程封装包的尺度为第二历史时间段对应的线程封装包的尺度与第三系数的乘积,其中,第三系数小于1。
其中,处理模块1303还具体用于若比值小于等于第二预设阈值,则确定第二当前时间段对应的线程封装包的尺度为第二历史时间段对应的线程封装包的尺度与第四系数的乘积,其中,第四系数大于1。
本实施例的装置,对应的可用于执行消息传输方法实施例七所示的技术方案,其实现原理和技术效果类似,此处不再赘述。
图14为本申请消息传输装置实施例四的结构示意图,本实施例的装置包括处理器1401和发送器1402,其中,处理器1401用于对线程单元产生的消息进行封装处理,生成消息单元,消息单元包含至少两个消息;发送器1402发送器耦合至处理器,发送器用于向源进程单元的发送队列发送消息单元。
本实施例的装置,对应的可用于执行消息传输方法实施例四所示的技术方案,其实现原理和技术效果类似,此处不再赘述。
在图14中,处理器1401具体用于根据第二当前时间段对应的线程封装包的尺度,对线程单元产生的消息进行封装处理,生成消息单元。
在图14中,处理器1401还用于根据第二历史时间段内线程单元产生的消息的数量,
确定第二当前时间段对应的线程封装包的尺度。
本实施例的装置,对应的可用于执行消息传输方法实施例五所示的技术方案,其实现原理和技术效果类似,此处不再赘述。
在图14中,消息单元包括第一消息单元;
处理器1401具体用于若线程单元产生的目的线程单元为同一线程单元的消息的数量大于等于第二当前时间段对应的线程封装包的尺度,则按照线程封装包的尺度,对目的线程单元为同一线程单元的消息进行封装处理,生成第一消息单元,其中,第一消息单元中包含的消息的数量与线程封装包的尺度相同。
在图14中,消息单元还包括第二消息单元;
处理器1401还具体用于若线程单元产生的目的线程单元为同一线程单元的消息的数量小于第二当前时间段对应的线程封装包的尺度,则确定目的线程单元为同一线程单元的消息中最早产生的消息的第二等待时间是否大于等于第二预设定时时间,若第二等待时间大于等于第二预设定时时间,则对目的线程单元为同一线程单元的消息进行封装处理,生成第二消息单元,其中,第二消息单元中包含线程单元产生的目的线程单元为同一线程单元的所有消息。
本实施例的装置,对应的可用于执行消息传输方法实施例六所示的技术方案,其实现原理和技术效果类似,此处不再赘述。
在图14中,处理器1401具体用于获取第二历史时间段内,通过第一消息单元和第二消息单元发送的消息的第三数量;以及,获取第二历史时间段内,通过第二消息单元发送的消息的第四数量;根据第四数量和第三数量的比值以及第二历史时间段对应的线程封装包的尺度,确定第二当前时间段对应的线程封装包的尺度。
在图14中,处理器1401具体用于若比值大于第二预设阈值,则确定第二当前时间段对应的线程封装包的尺度为第二历史时间段对应的线程封装包的尺度与第三系数的乘积,其中,第三系数小于1。
在图14中,处理器1401还具体用于若比值小于等于第二预设阈值,则确定第二当前时间段对应的线程封装包的尺度为第二历史时间段对应的线程封装包的尺度与第四系数的乘积,其中,第四系数大于1。
本实施例的装置,对应的可用于执行消息传输方法实施例七所示的技术方案,其实
现原理和技术效果类似,此处不再赘述。
图15为本申请消息传输系统实施例三的结构示意图,如图15所示,该系统包括,进程单元,进程单元包括源线程单元和目的线程单元;在图15中,进程单元以进程单元A示出,源线程单元以线程单元A1示出,目的线程单元以线程单元A2示出;源线程单元确定源线程单元产生的消息的目的线程单元是否属于同一进程单元;源线程单元若消息的目的线程单元属于同一进程单元,则向目的线程单元的接收队列发送消息。
图15所示消息传输系统实施例中源进程单元具体可用于执行图16所示方法实施例的技术方案,其实现原理和技术效果,参见图16所示方法实施例中的详细描述,此处不再赘述。
图16为本申请消息传输方法实施例八的流程示意图,本实施例所对应的技术方案可以独立执行,也可以结合上述各实施例,在上述各实施例的基础上执行,具体如下:
S1601:源线程单元确定产生的消息的目的线程单元是否与源线程单元属于同一进程单元。
结合图1,例如:源线程单元为线程单元A1,产生的消息的目的线程单元为线程单元A2或者线程单元A3,则认为产生的消息的目的线程单元与源线程单元属于同一进程单元。
再例如:源线程单元为线程单元A1,产生的消息的目的线程单元为线程单元B1、线程单元B2或者线程单元B3,则认为产生的消息的目的线程单元与源线程单元不属于同一进程单元。
若线程单元产生的消息的目的线程单元属于源线程单元,则执行S1602。
S1602:源线程单元发送消息到目的线程单元的接收队列。
即:无需先将消息发送到进程单元的发送队列,再通过网络通道发送到该进程单元的接收队列,再发送到目的线程单元,而是直接在进程单元内部,将消息从一个线程单元传输到另一个线程单元,从而,缩短消息发送的时延。
例如:图1中的线程单元A1产生的消息的目的线程单元为线程单元A2,则直接在进程单元A内,将消息从线程单元A1发送到线程单元A2的接收队列。
本实施例,通过确定线程单元产生的消息的目的线程单元是否属于源线程单元,当线程单元产生的消息的目的线程单元属于源线程单元,则直接发送消息到目的线程单元
的接收队列,从而,缩短消息发送的时延,提高消息传输效率。
图17为本申请消息传输装置实施例五的结构示意图,本实施例的装置包括处理模块1701和发送模块1702,其中,处理模块1701用于确定产生的消息的目的线程单元是否与源线程单元属于同一进程单元;发送模块1702用于若消息的目的线程单元与源线程单元属于同一进程单元,则向目的线程单元的接收队列发送消息。
本实施例的装置,对应的可用于执行消息传输方法实施例八所示的技术方案,其实现原理和技术效果类似,此处不再赘述。
图18为本申请消息传输装置实施例六的结构示意图,本实施例的装置包括处理器1801和发送器1802,其中,处理器1801用于确定产生的消息的目的线程单元是否与源线程单元属于同一进程单元;发送器1802耦合至处理器1801,发送器1802用于若消息的目的线程单元与源线程单元属于同一进程单元,则向目的线程单元的接收队列发送所述消息。
本实施例的装置,对应的可用于执行消息传输方法实施例八所示的技术方案,其实现原理和技术效果类似,此处不再赘述。
本申请还可提供一种处理器可读存储介质,该可读存储介质中存储有程序指令,该程序指令用于使处理器执行上述消息传输方法实施例一至实施例八中所有步骤或部分步骤。上述可读存储存储介质可以是由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘
最后应说明的是:以上各实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述各实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。
Claims (36)
- 一种消息传输系统,其特征在于,包括:源进程单元和目的进程单元,所述源进程单元包含至少一个线程单元,所述源进程单元和所述目的进程单元连接;其中,所述源进程单元,用于根据第一历史时间段所述至少一个线程单元向所述源进程单元的发送队列发送消息单元的频率,确定所述源进程单元的第一当前时间段对应的进程封装包的尺度,所述消息单元中包含至少一个消息;所述源进程单元,还用于根据所述第一当前时间段对应的进程封装包的尺度,对所述源进程单元的发送队列中的消息单元进行封装处理,生成进程封装包;所述源进程单元,还用于向所述目的进程单元发送所述进程封装包。
- 根据权利要求1所述的系统,其特征在于,所述源进程单元具体用于若所述源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量大于等于所述第一当前时间段对应的进程封装包的尺度,则按照所述第一当前时间段对应的进程封装包的尺度,对所述目的进程单元为同一进程单元的消息单元进行封装处理,生成第一进程封装包,其中,所述第一进程封装包中包含的消息单元的数量与所述第一当前时间段对应的进程封装包的尺度相同。
- 根据权利要求2所述的系统,其特征在于,所述源进程单元还具体用于若所述源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量小于所述第一当前时间段对应的进程封装包的尺度,则确定所述目的进程单元为同一进程单元的消息单元中最早进入所述发送队列的消息单元的第一等待时间是否大于等于第一预设定时时间,若所述第一等待时间大于等于所述第一预设定时时间,则对所述目的进程单元为同一进程单元的消息单元进行封装处理,生成第二进程封装包,所述第二进程封装包中包含所述发送队列中目的进程单元为同一进程单元的所有消息单元。
- 根据权利要求3所述的系统,其特征在于,所述源进程单元具体用于获取所述第一历史时间段内,通过所述第一进程封装包和所述第二进程封装包发送的消息单元的第一数量;以及,获取所述第一历史时间段内,通过所述第二进程封装包发送的消息单元的第二数量;根据所述第二数量和所述第一数量的比值以及所述第一历史时间段对应的进程封装包的尺度,确定所述第一当前时间段对应的进程封装包的尺度。
- 一种消息传输方法,其特征在于,包括:根据第一历史时间段源进程单元的线程单元向所述源进程单元的发送队列发送消息单元的频率,确定所述源进程单元的第一当前时间段对应的进程封装包的尺度,所述消息单元中包含至少一个消息;根据所述第一当前时间段对应的进程封装包的尺度,对所述源进程单元的发送队列中的消息单元进行封装处理,生成进程封装包;发送所述进程封装包。
- 根据权利要求5所述的方法,其特征在于,所述进程封装包包括:第一进程封装包;所述根据所述第一当前时间段对应的进程封装包的尺度,对所述源进程单元的发送队列中的消息单元进行封装处理,生成进程封装包,包括:若所述源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量大于等于所述第一当前时间段对应的进程封装包的尺度,则按照所述第一当前时间段对应的进程封装包的尺度,对所述目的进程单元为同一进程单元的消息单元进行封装处理,生成第一进程封装包,其中,所述第一进程封装包中包含的消息单元的数量与所述第一当前时间段对应的进程封装包的尺度相同。
- 根据权利要求6所述的方法,其特征在于,所述进程封装包还包括:第二进程封装包;所述方法还包括:若所述源进程单元的发送队列中目的进程单元为同一进程单元的消息单元的数量小于所述第一当前时间段对应的进程封装包的尺度,则确定所述目的进程单元为同一进程单元的消息单元中最早进入所述发送队列的消息单元的第一等待时间是否大于等于第一预设定时时间,若所述第一等待时间大于等于所述第一预设定时时间,则对所述目的进程单元为同一进程单元的消息单元进行封装处理,生成第二进程封装包,所述第二进程封装包中包含所述发送队列中目的进程单元为同一进程单元的所有消息单元。
- 根据权利要求7所述的方法,其特征在于,所述根据第一历史时间段源进程单元的线程单元向所述源进程单元的发送队列发送消息单元的频率,确定所述源进程单元的第一当前时间段对应的进程封装包的尺度,包括:获取所述第一历史时间段内,通过所述第一进程封装包和所述第二进程封装包发送的消息单元的第一数量;以及,获取所述第一历史时间段内,通过所述第二进程封装包发送的消息单元的第二数 量;根据所述第二数量和所述第一数量的比值以及所述第一历史时间段对应的进程封装包的尺度,确定所述第一当前时间段对应的进程封装包的尺度。
- 根据权利要求8所述的方法,其特征在于,所述根据所述第二数量和所述第一数量的比值以及所述第一历史时间段对应的进程封装包的尺度,确定所述第一当前时间段对应的进程封装包的尺度,包括:若所述比值大于第一预设阈值,则确定所述第一当前时间段对应的进程封装包的尺度为所述第一历史时间段对应的进程封装包的尺度与第一系数的乘积,其中,所述第一系数小于1。
- 根据权利要求9所述的方法,其特征在于,还包括:若所述比值小于等于所述第一预设阈值,则确定所述第一当前时间段对应的进程封装包的尺度为所述第一历史时间段对应的进程封装包的尺度与第二系数的乘积,其中,所述第二系数大于1。
- 根据权利要求10所述的方法,其特征在于,还包括:确定所述第一数量与第三数量的比值为所述第二系数,其中,所述第三数量为所述第一历史时间段的前一时间段通过所述第一进程封装包和所述第二进程封装包发送的消息单元的数量。
- 根据权利要求9-11任一项所述的方法,其特征在于,所述第一预设阈值为0.5。
- 一种消息传输装置,其特征在于,包括:处理模块,用于根据第一历史时间段源进程单元的线程单元向所述源进程单元的发送队列发送消息单元的频率,确定所述源进程单元的第一当前时间段对应的进程封装包的尺度,所述消息单元中包含至少一个消息;封装模块,用于根据所述第一当前时间段对应的进程封装包的尺度,对所述源进程单元的发送队列中的消息单元进行封装处理,生成进程封装包;发送模块,用于发送所述进程封装包。
- 一种消息传输装置,其特征在于,包括:处理器和发送器,所述处理器用于根据第一历史时间段源进程单元的线程单元向所述源进程单元的发送队列发送消息单元的频率,确定所述源进程单元的第一当前时间段对应的进程封装包的尺度,所述消息单元中包含至少一个消息;所述处理器还用于根据所述第一当前时间段对应的进程封装包的尺度,对所述源进 程单元的发送队列中的消息单元进行封装处理,生成进程封装包;所述发送器耦合至所述处理器,所述发送器用于发送所述进程封装包。
- 一种消息传输系统,其特征在于,包括:源进程单元,所述源进程单元包括至少一个线程单元;所述线程单元,用于对所述线程单元产生的消息进行封装处理,生成消息单元,所述消息单元中包含至少两个消息;所述线程单元,还用于向所述源进程单元的发送队列发送所述消息单元。
- 根据权利要求15所述的系统,其特征在于,所述线程单元具体用于根据第二当前时间段对应的线程封装包的尺度,对所述线程单元产生的消息进行封装处理,生成所述消息单元;
- 根据权利要求16所述的系统,其特征在于,所述线程单元还用于根据第二历史时间段内所述线程单元产生的消息的数量,确定所述第二当前时间段对应的线程封装包的尺度。
- 根据权利要求17所述的系统,其特征在于,所述线程单元具体用于若所述线程单元产生的目的线程单元为同一线程单元的消息的数量大于等于所述第二当前时间段对应的线程封装包的尺度,则按照所述线程封装包的尺度,对所述目的线程单元为同一线程单元的消息进行封装处理,生成第一消息单元,其中,所述第一消息单元中包含的消息的数量与所述线程封装包的尺度相同。
- 根据权利要求18所述的系统,其特征在于,所述线程单元还具体用于若所述线程单元产生的目的线程单元为同一线程单元的消息的数量小于所述第二当前时间段对应的线程封装包的尺度,则确定所述目的线程单元为同一线程单元的消息中最早产生的消息的第二等待时间是否大于等于第二预设定时时间,若所述第二等待时间大于等于所述第二预设定时时间,则对所述目的线程单元为同一线程单元的消息进行封装处理,生成第二消息单元,其中,所述第二消息单元中包含所述线程单元产生的目的线程单元为同一线程单元的所有消息。
- 根据权利要求19所述的系统,其特征在于,所述线程单元具体用于获取所述第二历史时间段内,通过所述第一消息单元和所述第二消息单元发送的消息的第三数量;以及,获取所述第二历史时间段内,通过所述第二消息单元发送的消息的第四数量;根据所述第四数量和所述第三数量的比值以及所述第二历史时间段对应的线程封装包的尺度,确定所述第二当前时间段对应的线程封装包的尺度。
- 一种消息传输方法,其特征在于,包括:对线程单元产生的消息进行封装处理,生成消息单元,所述消息单元包含至少两个消息;向所述源进程单元的发送队列发送所述消息单元。
- 根据权利要求21所述的方法,其特征在于,所述对线程单元产生的消息进行封装处理包括:根据第二当前时间段对应的线程封装包的尺度,对线程单元产生的消息进行封装处理,生成所述消息单元。
- 根据权利要求22所述的方法,其特征在于,所述根据第二当前时间段对应的线程封装包的尺度,对线程单元产生的消息进行封装处理,生成所述消息单元之前,还包括:根据第二历史时间段内所述线程单元产生的消息的数量,确定所述第二当前时间段对应的线程封装包的尺度。
- 根据权利要求23所述的方法,其特征在于,所述消息单元包括第一消息单元;所述根据第二当前时间段对应的线程封装包的尺度,对线程单元产生的消息进行封装处理,生成所述消息单元,包括:若所述线程单元产生的目的线程单元为同一线程单元的消息的数量大于等于所述第二当前时间段对应的线程封装包的尺度,则按照所述线程封装包的尺度,对所述目的线程单元为同一线程单元的消息进行封装处理,生成第一消息单元,其中,所述第一消息单元中包含的消息的数量与所述线程封装包的尺度相同。
- 根据权利要求24所述的方法,其特征在于,所述消息单元还包括第二消息单元;所述方法还包括:若所述线程单元产生的目的线程单元为同一线程单元的消息的数量小于所述第二当前时间段对应的线程封装包的尺度,则确定所述目的线程单元为同一线程单元的消息中最早产生的消息的第二等待时间是否大于等于第二预设定时时间,若所述第二等待时间大于等于所述第二预设定时时间,则对所述目的线程单元为同一线程单元的消息进行封装处理,生成第二消息单元,其中,所述第二消息单元中包含所述线程单元产生的目的线程单元为同一线程单元的所有消息。
- 根据权利要求25所述的方法,其特征在于,所述根据第二历史时间段内所述 线程单元产生的消息的数量,确定所述第二当前时间段对应的线程封装包的尺度,包括:获取所述第二历史时间段内,通过所述第一消息单元和所述第二消息单元发送的消息的第三数量;以及,获取所述第二历史时间段内,通过所述第二消息单元发送的消息的第四数量;根据所述第四数量和所述第三数量的比值以及所述第二历史时间段对应的线程封装包的尺度,确定所述第二当前时间段对应的线程封装包的尺度。
- 根据权利要求26所述的方法,其特征在于,所述根据所述第四数量和所述第三数量的比值以及所述第二历史时间段对应的线程封装包的尺度,确定所述第二当前时间段对应的线程封装包的尺度,包括:若所述比值大于第二预设阈值,则确定所述第二当前时间段对应的线程封装包的尺度为所述第二历史时间段对应的线程封装包的尺度与第三系数的乘积,其中,所述第三系数小于1。
- 根据权利要求27所述的方法,其特征在于,还包括:若所述比值小于等于所述第二预设阈值,则确定所述第二当前时间段对应的线程封装包的尺度为所述第二历史时间段对应的线程封装包的尺度与第四系数的乘积,其中,所述第四系数大于1。
- 根据权利要求27或28所述的方法,其特征在于,所述第二预设阈值为0.5。
- 根据权利要求24或25所述的方法,其特征在于,所述根据第二当前时间段对应的线程封装包的尺度,对线程单元产生的消息进行封装处理,生成所述消息单元之前,还包括:确定所述线程单元产生的消息的目的线程单元不属于所述源进程单元。
- 一种消息传输装置,其特征在于,包括:封装模块,用于对线程单元产生的消息进行封装处理,生成消息单元,所述消息单元包含至少两个消息;发送模块,用于向所述源进程单元的发送队列发送所述消息单元。
- 一种消息传输装置,其特征在于,包括:处理器和发送器,所述处理器用于对线程单元产生的消息进行封装处理,生成消息单元,所述消息单元包含至少两个消息;所述发送器耦合至所述处理器,所述发送器用于向所述源进程单元的发送队列发送所述消息单元。
- 一种消息传输系统,其特征在于,包括:进程单元,所述进程单元包括源线程单元和目的线程单元;所述源线程单元,用于确定所述源线程单元产生的消息的目的线程单元是否属于同一进程单元;所述源线程单元,还用于若所述消息的目的线程单元属于同一进程单元,则向所述目的线程单元的接收队列发送所述消息。
- 一种消息传输方法,其特征在于,包括:确定产生的消息的目的线程单元是否与源线程单元属于同一进程单元;若所述消息的目的线程单元与源线程单元属于同一进程单元,则向所述目的线程单元的接收队列发送所述消息。
- 一种消息传输装置,其特征在于,包括:处理模块,用于确定产生的消息的目的线程单元是否与源线程单元属于同一进程单元;发送模块,用于若所述消息的目的线程单元与源线程单元属于同一进程单元,则向所述目的线程单元的接收队列发送所述消息。
- 一种消息传输装置,其特征在于,包括:处理器和发送器,所述处理器用于确定产生的消息的目的线程单元是否与源线程单元属于同一进程单元;所述发送器耦合至所述处理器,所述发送器用于若所述消息的目的线程单元与源线程单元属于同一进程单元,则向所述目的线程单元的接收队列发送所述消息。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610726969.6A CN107783845B (zh) | 2016-08-25 | 2016-08-25 | 消息传输系统、方法和装置 |
| CN201610726969.6 | 2016-08-25 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2018036406A1 true WO2018036406A1 (zh) | 2018-03-01 |
Family
ID=61245472
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2017/097492 Ceased WO2018036406A1 (zh) | 2016-08-25 | 2017-08-15 | 消息传输系统、方法和装置 |
Country Status (3)
| Country | Link |
|---|---|
| CN (1) | CN107783845B (zh) |
| TW (1) | TWI752967B (zh) |
| WO (1) | WO2018036406A1 (zh) |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1975680A (zh) * | 2006-11-27 | 2007-06-06 | 浙江大学 | 基于Java的进程间异步通信的实现方法 |
| CN101127685A (zh) * | 2007-09-20 | 2008-02-20 | 中兴通讯股份有限公司 | 一种进程间通讯装置及其进程间通讯方法 |
| US8401952B1 (en) * | 2009-03-24 | 2013-03-19 | Trading Technologies International, Inc. | Trade order submission for electronic trading |
| CN103164267A (zh) * | 2013-03-29 | 2013-06-19 | 汉柏科技有限公司 | 无锁消息队列实现方法 |
| CN103207806A (zh) * | 2012-01-12 | 2013-07-17 | 阿里巴巴集团控股有限公司 | 一种发送消息的方法及其系统 |
Family Cites Families (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| EP0689139A3 (en) * | 1994-06-22 | 1997-09-10 | Ibm | Anonymous response port method and apparatus for microkernel data processing system |
| US6385658B2 (en) * | 1997-06-27 | 2002-05-07 | Compaq Information Technologies Group, L.P. | Method and apparatus for synchronized message passing using shared resources |
| US6744765B1 (en) * | 2000-08-24 | 2004-06-01 | Sun Microsystems, Inc. | Mechanism for completing messages in memory |
| CN102377631B (zh) * | 2010-08-06 | 2015-08-05 | 北京乾唐视联网络科技有限公司 | 一种基于流量控制的数据传输方法及通信系统 |
| WO2013097140A1 (en) * | 2011-12-29 | 2013-07-04 | Intel Corporation | Shaping data packet traffic |
| CN103853621B (zh) * | 2012-12-05 | 2017-10-24 | 腾讯科技(深圳)有限公司 | 一种跨进程交互方法及相关终端设备 |
| US9680742B2 (en) * | 2014-02-28 | 2017-06-13 | Cavium, Inc. | Packet output processing |
| US20150295841A1 (en) * | 2014-04-14 | 2015-10-15 | Qualcomm Incorporated | Efficient packet aggregation using dynamic wait time |
| CN104159129B (zh) * | 2014-08-08 | 2015-06-17 | 北京大学 | 一种遥感数据有限带宽下剖分分块渐进传输方法 |
-
2016
- 2016-08-25 CN CN201610726969.6A patent/CN107783845B/zh active Active
-
2017
- 2017-06-14 TW TW106119852A patent/TWI752967B/zh not_active IP Right Cessation
- 2017-08-15 WO PCT/CN2017/097492 patent/WO2018036406A1/zh not_active Ceased
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1975680A (zh) * | 2006-11-27 | 2007-06-06 | 浙江大学 | 基于Java的进程间异步通信的实现方法 |
| CN101127685A (zh) * | 2007-09-20 | 2008-02-20 | 中兴通讯股份有限公司 | 一种进程间通讯装置及其进程间通讯方法 |
| US8401952B1 (en) * | 2009-03-24 | 2013-03-19 | Trading Technologies International, Inc. | Trade order submission for electronic trading |
| CN103207806A (zh) * | 2012-01-12 | 2013-07-17 | 阿里巴巴集团控股有限公司 | 一种发送消息的方法及其系统 |
| CN103164267A (zh) * | 2013-03-29 | 2013-06-19 | 汉柏科技有限公司 | 无锁消息队列实现方法 |
Also Published As
| Publication number | Publication date |
|---|---|
| TWI752967B (zh) | 2022-01-21 |
| TW201807585A (zh) | 2018-03-01 |
| CN107783845A (zh) | 2018-03-09 |
| CN107783845B (zh) | 2021-04-13 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP7394986B2 (ja) | データパケットを送信する方法、及びこの方法を実施する装置 | |
| CN113271264B (zh) | 一种时间敏感网络的数据流传输方法和装置 | |
| WO2021042783A1 (zh) | 一种视频画面显示方法、装置、电子设备及存储介质 | |
| CN103259683A (zh) | 基于HTML5的Web网管系统二级缓存推送方法 | |
| WO2019134383A1 (zh) | 控制网络拥塞的方法、接入设备和计算机可读存储介质 | |
| AU2011370439B2 (en) | Method and apparatus for rapid data distribution | |
| CN110352588A (zh) | 用于收集遥测数据的简档 | |
| CN102790776A (zh) | 心跳连接归一处理方法、终端、服务器及通信系统 | |
| CN109314673A (zh) | 一种客户业务传输方法和装置 | |
| WO2017114400A1 (zh) | 时序数据检测方法及装置 | |
| CN113760559A (zh) | 一种双核通信方法和电子设备 | |
| CN114095397A (zh) | 传输报文的方法、装置、设备及可读存储介质 | |
| CN114915596B (zh) | 数据发送方法、装置、设备及存储介质 | |
| CN104869077B (zh) | 令牌传输控制方法及系统 | |
| CN116418710A (zh) | 确定时延的方法和装置 | |
| CN111953655B (zh) | 一种通信系统中服务器响应请求消息的方法及设备 | |
| CN107766127A (zh) | 事务消息处理方法、装置、设备及系统 | |
| WO2019128649A1 (zh) | 一种发送数据流的方法、设备和系统 | |
| CN117320163A (zh) | 一种数据传输方法和设备 | |
| WO2016095323A1 (zh) | 一种基于串口服务器的数据传输方法及装置 | |
| WO2017174021A1 (zh) | 端口流量管理方法、装置及计算机存储介质 | |
| WO2018036406A1 (zh) | 消息传输系统、方法和装置 | |
| WO2022188807A1 (zh) | 数据传输系统及相关设备 | |
| TW201811083A (zh) | 通訊系統以及通訊方法 | |
| US20120066305A1 (en) | Transmitting system and method thereof |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 17842829 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 17842829 Country of ref document: EP Kind code of ref document: A1 |