CN113973110A - Message generation method and device and electronic equipment - Google Patents

Message generation method and device and electronic equipment Download PDF

Info

Publication number
CN113973110A
CN113973110A CN202111242548.3A CN202111242548A CN113973110A CN 113973110 A CN113973110 A CN 113973110A CN 202111242548 A CN202111242548 A CN 202111242548A CN 113973110 A CN113973110 A CN 113973110A
Authority
CN
China
Prior art keywords
message
value
initial
target
checksum
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.)
Granted
Application number
CN202111242548.3A
Other languages
Chinese (zh)
Other versions
CN113973110B (en
Inventor
吕逸凡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202111242548.3A priority Critical patent/CN113973110B/en
Publication of CN113973110A publication Critical patent/CN113973110A/en
Application granted granted Critical
Publication of CN113973110B publication Critical patent/CN113973110B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/08Protocols for interworking; Protocol conversion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

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

Abstract

The invention relates to a network communication technology, and discloses a message generation method, a message generation device and electronic equipment, wherein the message generation method comprises the following steps: scheduling and converting the initial message by using a preset load balancer to obtain an output message; inquiring a message format conversion rule corresponding to the load balancer in a preset conversion rule table; performing message difference analysis on the output message and the initial message according to the message format conversion rule to obtain a target difference value; extracting the inspection sum in the initial message, and carrying out message inspection sum calculation according to the target difference and the inspection sum to obtain an output message inspection sum; and carrying out message construction according to the output message inspection and the output message to obtain a target message. The invention can improve the efficiency of message generation.

Description

Message generation method and device and electronic equipment
Technical Field
The present application relates to the field of network communication technologies, and in particular, to a method and an apparatus for generating a packet, and an electronic device.
Background
With the development of the internet, in order to expand the bandwidth of network devices and servers and improve the throughput, the application of load balancing is more and more extensive.
However, a new problem brought by the application of load balancing is that network messages need to be sent through a load balancer, a header field of a message changes when the message passes through the load balancer, the load balancer needs to calculate a checksum of the message after the field changes to generate a new message, but calculation of the checksum is a CPU-intensive task, and the speed of calculating the checksum of the changed message by the load balancer as a whole is slow, so that the message generation efficiency is low.
Disclosure of Invention
In order to solve the above technical problem or at least partially solve the above technical problem, the present application provides a method and an apparatus for generating a packet, which can improve the efficiency of generating a packet.
In a first aspect, the present application provides a method for generating a packet, including:
scheduling and converting the initial message by using a preset load balancer to obtain an output message;
inquiring a message format conversion rule corresponding to the load balancer in a preset conversion rule table;
performing message difference analysis on the output message and the initial message according to the message format conversion rule to obtain a target difference value; and
extracting the inspection sum in the initial message, and carrying out message inspection sum calculation according to the target difference and the inspection sum to obtain an output message inspection sum;
and carrying out message construction according to the output message inspection and the output message to obtain a target message.
Optionally, the extracting a checksum in the initial message, and performing message checksum calculation according to the target difference and the checksum to obtain an output message checksum includes:
extracting a value corresponding to a checksum field in the initial message to obtain a checksum;
and calculating to obtain an output message inspection sum according to the target difference and the inspection sum.
Optionally, the calculating to obtain an output packet checksum according to the target difference and the checksum includes:
carrying out negation treatment on the inspection sum to obtain a first inspection sum;
calculating according to the first check sum and the target difference value to obtain a second check sum;
when the second check sum is zero, taking the second check sum as the check sum of the output message;
when the second checksum is not zero, adding the high N bit and the low N bit of the second checksum to obtain an updated second checksum;
and performing negation processing on the updated second checksum to obtain the checksum of the output message.
Optionally, the calculating according to the first checksum and the target difference to obtain a second checksum includes:
step A, judging whether the absolute value of the target difference value is larger than the first check sum;
step B, if the absolute value of the target difference is larger than the first check sum, judging whether the target difference is a negative value;
step C, if the target difference value is a negative value, performing borrowing processing on the target difference value, and adding the borrowed target difference value and the first check sum to obtain a second check sum;
step D, if the target difference value is a non-negative value, adding the first check sum and the target difference value to obtain a second check sum;
and E, if the absolute value of the target difference is not larger than the first check sum, adding the first check sum and the target difference to obtain a second check sum.
Optionally, the performing, according to the message format conversion rule, message difference analysis on the output message and the initial message to obtain a target difference value includes:
extracting the value of the field in the output message according to the message format conversion rule to obtain a target field value set;
extracting the value of the field in the initial message according to the message format conversion rule to obtain an initial field value set;
converting each value in the target field value set and the value of the corresponding field in the initial field value set into a preset type of numerical value, and then calculating to obtain an initial difference value;
and calculating to obtain the target difference value according to all the initial difference values.
Optionally, the performing, according to the message format conversion rule, message difference analysis on the output message and the initial message to obtain a target difference value, further includes:
screening and judging newly added fields by using the target difference value and the message format conversion rule;
and when the newly added field exists, converting the value corresponding to the newly added field in the output message into a numerical value of a preset type, and then summing the numerical value and the target difference value to obtain an updated target difference value.
Optionally, the performing, by using a preset load balancer, scheduling conversion processing on the initial packet to obtain an output packet includes:
scheduling and screening all server nodes in the server cluster by using a scheduling algorithm in the load balancer to obtain a target server;
and acquiring the information of the target server, and performing route conversion on the initial message according to the information of the target server to obtain the output message.
Optionally, the performing, according to the information of the target server, route conversion on the initial packet to obtain the output packet includes:
setting a source IP/port field contained in the initial message as an IP and a port of the load balancer; and
and setting a destination IP/port field contained in the initial message as the IP and the port of the target server to obtain the output message.
In a second aspect, the present application provides a device for generating a packet, including:
the rule query module is used for carrying out scheduling conversion processing on the initial message by utilizing a preset load balancer to obtain an output message; inquiring a message format conversion rule corresponding to the load balancer in a preset conversion rule table;
the inspection and calculation module is used for performing message difference analysis on the output message and the initial message according to the message format conversion rule to obtain a target difference value; extracting the inspection sum in the initial message, and carrying out message inspection sum calculation according to the target difference and the inspection sum to obtain an output message inspection sum;
and the message construction module is used for carrying out message construction according to the output message inspection and the output message to obtain a target message.
In a third aspect, an electronic device is provided, which includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
the processor is configured to implement the steps of the message generation method according to any embodiment of the first aspect when executing the program stored in the memory. Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages:
according to the method provided by the embodiment of the application, the inspection sum of the output message and the response message is obtained by calculating the change part of the output message and the inspection sum of the initial message, and the inspection sum of the output message does not need to be integrally calculated, so that the calculation efficiency of the inspection sum of the output message is improved, and the generation efficiency of the message is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a detailed flowchart of a message generation method according to an embodiment of the present application.
Fig. 2 is a schematic diagram of a detailed flow of obtaining an output packet in a packet generation method according to an embodiment of the present application.
Fig. 3 is a schematic diagram of a detailed flow of obtaining a target difference in a message generation method according to an embodiment of the present application.
Fig. 4 is a schematic module diagram of a message generation apparatus according to an embodiment of the present application.
Fig. 5 is a schematic structural diagram of an electronic device for generating a message according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 1 is a schematic flow diagram of a message generation method according to an embodiment of the present disclosure, where in the embodiment of the present disclosure, the message generation method includes:
s1, carrying out scheduling conversion processing on the initial message by using a preset load balancer to obtain an output message;
in the embodiment of the invention, the initial message is a network message which needs to be forwarded by the client, such as a TCP/UDP message.
In one application scenario of the embodiment of the present invention, the initial packet needs to be forwarded to a server node in a preset server cluster, but workloads of different server nodes of the server cluster are different. In order to ensure high availability of packet forwarding, the initial packet needs to be forwarded to a server node with a smaller load, so that a preset load balancer needs to be used to perform scheduling conversion processing on the initial packet, and a suitable server node is selected to obtain the output packet. The load balancer is a device which distributes all network requests to all server nodes of the server cluster in a balanced manner through various flexible distribution calculations.
In an embodiment of the present invention, referring to fig. 2, the performing scheduling conversion processing on the initial packet by using a preset load balancer to obtain an output packet includes:
s11, scheduling and screening all server nodes in the server cluster by using a scheduling algorithm in the load balancer to obtain a target server;
optionally, in this embodiment of the present invention, the scheduling algorithm includes: round robin algorithm, weighted round robin algorithm, least number of connections algorithm, weighted response algorithm.
S12, obtaining the information of the target server, and performing route conversion on the initial message according to the information of the target server to obtain the output message.
The information of the target server may include an IP and a port of the target server.
The initial message includes source IP/port and destination IP/port fields. In the embodiment of the present invention, the value corresponding to the source IP/port is an IP and a port of a client that sends an initial packet, and the value corresponding to the destination IP/port is an IP and a port corresponding to the load balancer, where the load balancer performs route conversion on the initial packet according to information of the target server to obtain the output packet.
In one embodiment of the present invention, the performing, according to the information of the target server, routing conversion on the initial packet to obtain the output packet includes: and setting a source IP/port field contained in the initial message as the IP and the port of the load balancer, and setting a destination IP/port field contained in the initial message as the IP and the port in the information of the target server to obtain the output message.
Because the IP and the port of the client cannot be seen in the output message, in another embodiment of the present invention, a preset field is added to the output message to store the information of the client, so as to ensure that the information of the client is not lost. The preset field may be, for example, toa field information. Wherein, the toa field includes the IP and the port of the client.
S2, inquiring the message format conversion rule corresponding to the load balancer in a preset conversion rule table;
when the load balancer is used for carrying out routing conversion on the initial message to obtain an output message, conversion rules corresponding to different load balancers are different, so that the embodiment of the invention inquires the message format conversion rule corresponding to the load balancer through a preset conversion rule table.
Optionally, in the embodiment of the present invention, an identifier code corresponding to the load balancer may be obtained, and a query statement is constructed by using the identifier code as a query parameter to query the conversion rule table for the message format conversion rule corresponding to the load balancer. The identification code corresponding to the load balancer may be an IP of the load balancer. Further, the message format conversion rule includes fields changed in the initial message and the output message, corresponding relations between the fields, newly added fields, and the like. Such as: the values corresponding to the source IP/port and the destination IP/port field in the initial message are respectively client IP, client port, VIP and V port, after passing through the load balancer A, the values corresponding to the source IP/port and the destination IP/port field in the initial message are changed into the values corresponding to the source IP/port and the destination IP/port field in the output message, namely local IP, local, RS IP and RS port, and the toa field and the value corresponding to the toa field are newly added in the output message, so that the message format conversion rule is that the value corresponding to the source IP field in the initial message corresponds to the local IP corresponding to the source IP field in the output message, the value corresponding to the source port field in the initial message corresponds to the local IP corresponding to the source port field in the initial message, the value corresponding to the source port field in the output message corresponds to the local IP corresponding to the destination IP field in the initial message, the value corresponding to the VIP field in the destination IP field in the initial message and the value corresponding to RS IP field in the output message, The value V port corresponding to the destination port field in the initial message corresponds to the value RS port corresponding to the destination port field in the output message, and the toa field is a newly added field in the output message.
S3, performing message difference analysis on the output message and the initial message according to the message format conversion rule to obtain a target difference value;
the embodiment of the invention determines the changed fields in the output message so as not to recalculate the checksum of the output message, thereby reducing the calculation time of the checksum and improving the generation efficiency of the message.
Optionally, referring to fig. 3, in an embodiment of the present invention, the S3 includes:
s30, extracting the value of the field in the output message according to the message format conversion rule to obtain a target field value set;
s31, extracting the value of the field in the initial message according to the message format conversion rule to obtain an initial field value set;
s32, converting each value in the target field value set and the value of the corresponding field in the initial field value set into a preset type of numerical value, and calculating to obtain an initial difference value;
because the types of the values corresponding to different fields are different, in order to facilitate unified calculation, in the embodiment of the present invention, the values corresponding to different fields need to be converted into the same type, and a preset type of numerical value is obtained and then calculated to obtain the corresponding initial difference. In one embodiment of the present invention, the preset type of value is a 16-bit binary value.
Optionally, in the embodiment of the present invention, the preset type of numerical value conversion is performed by using an ASCII code encoding manner.
In detail, in the embodiment of the present invention, each value in the target field value set and a value in a corresponding field in the initial field value set are converted into a preset type of numerical value, and then a difference is made to obtain the corresponding initial difference value.
And S33, calculating to obtain a target difference value according to all the initial difference values.
Specifically, in the embodiment of the present invention, the target difference is obtained by summing all the initial differences.
Further, since the output packet may have a newly added field, such as the toa field, relative to the initial packet, in order to ensure that all changed parts in the output packet are obtained, the embodiment of the present invention may further include:
s34, screening and judging newly added fields by using the target difference value and the message format conversion rule, converting the value corresponding to the newly added fields in the output message into a preset type of numerical value when the newly added fields exist, and then summing the numerical value and the target difference value to obtain an updated target difference value.
For example: the values corresponding to the source IP/port and the destination IP/port field in the initial message are respectively client IP, client port, VIP and V port, after passing through the load balancer A, the values corresponding to the source IP/port and the destination IP/port field in the initial message are changed into values corresponding to the source IP/port and the destination IP/port field in the output message, namely local IP, local, RS IP and RS port, and the toa option and the corresponding value are newly added in the output message The value V port corresponding to the destination port field in the initial message corresponds to the value RS port corresponding to the destination port field in the output message, and the toa field is a newly added field in the output message. Therefore, in the embodiment of the present invention, a value corresponding to the local IP field is subtracted from a value corresponding to the client IP field to obtain a difference a, a value corresponding to the local port field is subtracted from a value corresponding to the client port field to obtain a difference b, a value corresponding to the RS IP field is subtracted from a value corresponding to the VIP field to obtain a difference c, a value corresponding to the RS port field is subtracted from a value corresponding to the V port field to obtain a difference d, and a value corresponding to the toa field of the newly added field is e, so that the target difference is (a + b + c + d + e).
S4, extracting the inspection sum in the initial message, and carrying out message inspection sum calculation according to the target difference and the inspection sum to obtain an output message inspection sum;
in order to save computing resources and avoid overall computation of the checksum of the output message, the embodiment of the invention extracts the value corresponding to the checksum field in the initial message to obtain the checksum, and performs computation by using a preset algorithm according to the target difference and the checksum to obtain the checksum of the output message.
In detail, in the embodiment of the present invention, the calculating to obtain the checksum of the output packet according to the target difference and the checksum includes:
carrying out negation treatment on the inspection sum to obtain a first inspection sum;
calculating according to the first check sum and the target difference value to obtain a second check sum;
when the second check sum is zero, taking the second check sum as the check sum of the output message;
when the second checksum is not zero, adding the high N bit and the low N bit of the second checksum to obtain an updated second checksum;
and performing negation processing on the updated second checksum to obtain the checksum of the output message.
Further, in the embodiment of the present invention, the calculating according to the first checksum and the target difference to obtain a second checksum includes:
step A, judging whether the absolute value of the target difference value is larger than the first check sum;
step B, if the absolute value of the target difference is larger than the first check sum, judging whether the target difference is a negative value;
step C, if the target difference value is a negative value, performing borrowing processing on the target difference value, and adding the borrowed target difference value and the first check sum to obtain a second check sum;
for example: and if the target difference value is a, the target difference value after borrowing processing is (n +1) × 65535+ a, where n is the preset borrowing number.
Step D, if the target difference value is a non-negative value, adding the first check sum and the target difference value to obtain a second check sum;
and E, if the absolute value of the target difference is not larger than the first check sum, adding the first check sum and the target difference to obtain a second check sum.
Specifically, in the embodiment of the present invention, performing negation on the updated second checksum to obtain the checksum of the output packet, including:
step 1, judging whether the second check sum is zero or not;
step 2, if the second check sum is zero, taking the second check sum as an output message check sum;
step 3, if the second checksum is not zero, adding the high N bit and the low N bit of the second checksum to obtain a new second checksum,
optionally, in an embodiment of the present invention, N is 16.
Step 4, judging whether the second check sum is smaller than a preset threshold value or not;
optionally, in this embodiment of the present invention, the preset threshold is 0 xffff.
Step 5, if the second check sum is smaller than a preset threshold value, negating the second check sum to obtain an output message check sum;
in detail, the embodiment of the present invention inverts the second checksum to perform a bitwise inversion operation on the second checksum, such as: the second checksum is 00000101, and the second checksum is negated to yield an output message checksum of 11111010.
Step 6, if the second check sum is greater than or equal to a preset threshold value, judging whether the second check sum is zero;
step 7, if the second check sum is zero, taking the second check sum as an output message check sum;
and 8, if the second checksum is not zero, adding the high N bit and the low N bit of the second checksum to obtain a new second checksum, and returning to the step 1.
Optionally, in an embodiment of the present invention, N is 16.
For example: the second checksum is 0x11223344, where 0x1122 is the high 16 bits and 0x3344 is the low 16 bits, and 0x1122 and 0x3344 are added to obtain a new second checksum.
S5, carrying out message construction according to the output message inspection sum and the output message to obtain a target message.
In the embodiment of the present invention, the checksum field is a common field in all network messages, and the checksum field in the output message is checked and replaced with a value corresponding to the checksum field in the output message, so as to obtain the target message.
Fig. 4 is a functional block diagram of the message generating apparatus according to the present invention.
According to the implemented functions, the message generating apparatus 100 may include a rule query module 101, a check and calculation module 102, and a message construction module 103. The module of the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the rule query module 101 is configured to perform scheduling conversion processing on an initial packet by using a preset load balancer to obtain an output packet; inquiring a message format conversion rule corresponding to the load balancer in a preset conversion rule table;
the inspection and calculation module 102 is configured to perform packet difference analysis on the output packet and the initial packet according to the packet format conversion rule to obtain a target difference value; extracting the inspection sum in the initial message, and carrying out message inspection sum calculation according to the target difference and the inspection sum to obtain an output message inspection sum;
the message construction module 103 is configured to perform message construction according to the output message inspection and the output message to obtain a target message.
In detail, in the embodiment of the present invention, when the modules in the packet generation apparatus 100 are used, the same technical means as the packet generation method described in fig. 1 to fig. 3 are adopted, and the same technical effect can be produced, which is not described herein again.
As shown in fig. 5, an electronic device according to an embodiment of the present application includes a processor 111, a communication interface 112, a memory 113, and a communication bus 114, where the processor 111, the communication interface 112, and the memory 113 complete mutual communication via the communication bus 114,
a memory 113 for storing a computer program;
in an embodiment of the present application, when the processor 111 is configured to execute the program stored in the memory 113, the method for generating a message provided in any one of the foregoing method embodiments is implemented, including:
scheduling and converting the initial message by using a preset load balancer to obtain an output message;
inquiring a message format conversion rule corresponding to the load balancer in a preset conversion rule table;
performing message difference analysis on the output message and the initial message according to the message format conversion rule to obtain a target difference value; and
extracting the inspection sum in the initial message, and carrying out message inspection sum calculation according to the target difference and the inspection sum to obtain an output message inspection sum;
and carrying out message construction according to the output message inspection and the output message to obtain a target message.
The communication bus 114 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus 114 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface 112 is used for communication between the above-described electronic apparatus and other apparatuses.
The memory 113 may include a Random Access Memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory 113 may also be at least one storage device located remotely from the processor 111.
The processor 111 may be a general-purpose processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the integrated circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, or discrete hardware components.
The embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores one or more programs, and the one or more programs are executable by one or more processors to implement the message generation method in any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The procedures or functions according to the embodiments of the present application are all or partially generated when the computer program instructions are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wirelessly (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (ssd)), among others.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present invention, which enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A message generation method is characterized by comprising the following steps:
scheduling and converting the initial message by using a preset load balancer to obtain an output message;
inquiring a message format conversion rule corresponding to the load balancer in a preset conversion rule table;
performing message difference analysis on the output message and the initial message according to the message format conversion rule to obtain a target difference value;
extracting the inspection sum in the initial message, and carrying out message inspection sum calculation according to the target difference and the inspection sum to obtain an output message inspection sum; and
and carrying out message construction according to the output message inspection and the output message to obtain a target message.
2. The message generation method of claim 1, wherein the extracting a checksum in the initial message, performing a message checksum calculation based on the target difference and the checksum to obtain an output message checksum comprises:
extracting a value corresponding to a checksum field in the initial message to obtain a checksum;
and calculating to obtain an output message inspection sum according to the target difference and the inspection sum.
3. The message generation method of claim 2, wherein the calculating an output message checksum based on the target difference and the checksum comprises:
carrying out negation treatment on the inspection sum to obtain a first inspection sum;
calculating according to the first check sum and the target difference value to obtain a second check sum;
when the second check sum is zero, taking the second check sum as the check sum of the output message;
when the second checksum is not zero, adding the high N bit and the low N bit of the second checksum to obtain an updated second checksum;
and performing negation processing on the updated second checksum to obtain the checksum of the output message.
4. The message generation method of claim 3, wherein the calculating based on the first checksum and the target difference to obtain a second checksum comprises:
step A, judging whether the absolute value of the target difference value is larger than the first check sum;
step B, if the absolute value of the target difference is larger than the first check sum, judging whether the target difference is a negative value;
step C, if the target difference value is a negative value, performing borrowing processing on the target difference value, and adding the borrowed target difference value and the first check sum to obtain a second check sum;
step D, if the target difference value is a non-negative value, adding the first check sum and the target difference value to obtain a second check sum;
and E, if the absolute value of the target difference is not larger than the first check sum, adding the first check sum and the target difference to obtain a second check sum.
5. The message generation method according to claim 1, wherein the performing message difference analysis on the output message and the initial message according to the message format conversion rule to obtain a target difference value comprises:
extracting the value of the field in the output message according to the message format conversion rule to obtain a target field value set;
extracting the value of the field in the initial message according to the message format conversion rule to obtain an initial field value set;
converting each value in the target field value set and the value of the corresponding field in the initial field value set into a preset type of numerical value, and then calculating to obtain an initial difference value;
and calculating to obtain the target difference value according to all the initial difference values.
6. The message generation method according to claim 5, wherein the performing message difference analysis on the output message and the initial message according to the message format conversion rule to obtain a target difference value further comprises:
screening and judging newly added fields by using the target difference value and the message format conversion rule;
and when the newly added field exists, converting the value corresponding to the newly added field in the output message into a numerical value of a preset type, and then summing the numerical value and the target difference value to obtain an updated target difference value.
7. The message generation method according to any one of claims 1 to 6, wherein the performing scheduling conversion processing on the initial message by using a preset load balancer to obtain an output message comprises:
scheduling and screening all server nodes in the server cluster by using a scheduling algorithm in the load balancer to obtain a target server;
and acquiring the information of the target server, and performing route conversion on the initial message according to the information of the target server to obtain the output message.
8. The message generation method according to claim 7, wherein the performing routing conversion on the initial message according to the information of the target server to obtain the output message comprises:
setting a source IP/port field contained in the initial message as an IP and a port of the load balancer; and
and setting a destination IP/port field contained in the initial message as the IP and the port of the target server to obtain the output message.
9. A message generating apparatus, comprising:
the rule query module is used for carrying out scheduling conversion processing on the initial message by utilizing a preset load balancer to obtain an output message, and querying a message format conversion rule corresponding to the load balancer in a preset conversion rule table;
the inspection and calculation module is used for performing message difference analysis on the output message and the initial message according to the message format conversion rule to obtain a target difference value, extracting an inspection sum in the initial message, and performing message inspection and calculation according to the target difference value and the inspection sum to obtain an output message inspection sum; and
and the message construction module is used for carrying out message construction according to the output message inspection and the output message to obtain a target message.
10. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the steps of the message generation method according to any one of claims 1 to 8 when executing a program stored in the memory.
CN202111242548.3A 2021-10-25 2021-10-25 Message generation method and device and electronic equipment Active CN113973110B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111242548.3A CN113973110B (en) 2021-10-25 2021-10-25 Message generation method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111242548.3A CN113973110B (en) 2021-10-25 2021-10-25 Message generation method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN113973110A true CN113973110A (en) 2022-01-25
CN113973110B CN113973110B (en) 2024-03-15

Family

ID=79588212

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111242548.3A Active CN113973110B (en) 2021-10-25 2021-10-25 Message generation method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN113973110B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114584631A (en) * 2022-03-01 2022-06-03 中国农业银行股份有限公司 Message processing method and device, electronic equipment and storage medium
CN115037551A (en) * 2022-06-29 2022-09-09 北京奇艺世纪科技有限公司 Connection authority control method and device, electronic equipment and storage medium

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6324670B1 (en) * 1999-03-24 2001-11-27 Novell, Inc. Checksum generator with minimum overflow
WO2002007323A2 (en) * 2000-07-14 2002-01-24 Telefonaktiebolaget Lm Ericsson (Publ) Protocol header compression
US20030076794A1 (en) * 2001-10-18 2003-04-24 Takeshi Kawasaki Checksum rewrite device
CN1494279A (en) * 2002-11-02 2004-05-05 华为技术有限公司 Method of rapid calculating IP massage head checking sum
CN1509021A (en) * 2002-12-19 2004-06-30 华为技术有限公司 Method for realizing network address conversion
US20050089031A1 (en) * 2003-10-23 2005-04-28 Jon Krueger Determining a checksum from packet data
CN1691639A (en) * 2004-04-21 2005-11-02 华为技术有限公司 A method of fragmented packet transmission
US20060039387A1 (en) * 2004-08-23 2006-02-23 Yokogawa Electric Corporation Frame generator
US7475157B1 (en) * 2001-09-14 2009-01-06 Swsoft Holding, Ltd. Server load balancing system
CN102404210A (en) * 2011-11-15 2012-04-04 北京天融信科技有限公司 Method and device for incrementally calculating network message check sum
US20120246264A1 (en) * 2011-02-09 2012-09-27 Peter Bodorik Data Exchange Between Communicating Computing Equipment Using Differential Information
CN107786669A (en) * 2017-11-10 2018-03-09 华为技术有限公司 A kind of method of load balance process, server, device and storage medium
CN112866433A (en) * 2021-01-22 2021-05-28 京东数字科技控股股份有限公司 Message load balancing processing method and device and computer equipment

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6324670B1 (en) * 1999-03-24 2001-11-27 Novell, Inc. Checksum generator with minimum overflow
WO2002007323A2 (en) * 2000-07-14 2002-01-24 Telefonaktiebolaget Lm Ericsson (Publ) Protocol header compression
US7475157B1 (en) * 2001-09-14 2009-01-06 Swsoft Holding, Ltd. Server load balancing system
US20030076794A1 (en) * 2001-10-18 2003-04-24 Takeshi Kawasaki Checksum rewrite device
CN1494279A (en) * 2002-11-02 2004-05-05 华为技术有限公司 Method of rapid calculating IP massage head checking sum
CN1509021A (en) * 2002-12-19 2004-06-30 华为技术有限公司 Method for realizing network address conversion
US20050089031A1 (en) * 2003-10-23 2005-04-28 Jon Krueger Determining a checksum from packet data
CN1691639A (en) * 2004-04-21 2005-11-02 华为技术有限公司 A method of fragmented packet transmission
US20060039387A1 (en) * 2004-08-23 2006-02-23 Yokogawa Electric Corporation Frame generator
US20120246264A1 (en) * 2011-02-09 2012-09-27 Peter Bodorik Data Exchange Between Communicating Computing Equipment Using Differential Information
CN102404210A (en) * 2011-11-15 2012-04-04 北京天融信科技有限公司 Method and device for incrementally calculating network message check sum
CN107786669A (en) * 2017-11-10 2018-03-09 华为技术有限公司 A kind of method of load balance process, server, device and storage medium
CN112866433A (en) * 2021-01-22 2021-05-28 京东数字科技控股股份有限公司 Message load balancing processing method and device and computer equipment

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114584631A (en) * 2022-03-01 2022-06-03 中国农业银行股份有限公司 Message processing method and device, electronic equipment and storage medium
CN114584631B (en) * 2022-03-01 2024-04-12 中国农业银行股份有限公司 Message processing method and device, electronic equipment and storage medium
CN115037551A (en) * 2022-06-29 2022-09-09 北京奇艺世纪科技有限公司 Connection authority control method and device, electronic equipment and storage medium
CN115037551B (en) * 2022-06-29 2024-04-26 北京奇艺世纪科技有限公司 Connection authority control method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN113973110B (en) 2024-03-15

Similar Documents

Publication Publication Date Title
US10659371B1 (en) Managing throttling limits in a distributed system
CN113973110B (en) Message generation method and device and electronic equipment
CN107135268B (en) Distributed task computing method based on information center network
CN111327647B (en) Method and device for providing service to outside by container and electronic equipment
CN105917632A (en) A method for scalable distributed network traffic analytics in telco
CN109672558B (en) Aggregation and optimal matching method, equipment and storage medium for third-party service resources
US20160142432A1 (en) Resource classification using resource requests
Teranishi et al. Dynamic data flow processing in edge computing environments
US20210144629A1 (en) Wireless communication core network and method for analyzing user equipment mobility in the same
CN114567650B (en) Data processing method and Internet of things platform system
CN108153803A (en) A kind of data capture method, device and electronic equipment
US9407546B2 (en) Routing a message using a routing table in a dynamic service mesh
JPWO2016038857A1 (en) Scale number estimation apparatus, scale number management system, scale number estimation method, scale number management method, and computer program
CN110650209A (en) Method and device for realizing load balance
CN112929424B (en) Gateway load balancing method, device, equipment and storage medium
CN113703996B (en) Access control method, equipment and medium based on user and YANG model grouping
EP2622499B1 (en) Techniques to support large numbers of subscribers to a real-time event
Yi et al. Optimised approach for VNF embedding in NFV
Singh et al. Challenges of various load balancing algorithms in distributed environment
CN116668520A (en) Gateway-based service arrangement method, system, equipment and storage medium
CN113422699B (en) Data stream processing method and device, computer readable storage medium and electronic equipment
CN114490718A (en) Data output method, data output device, electronic equipment and computer readable medium
TW202315360A (en) Microservice allocation method, electronic equipment, and storage medium
CN113934767A (en) Data processing method and device, computer equipment and storage medium
CN114579311A (en) Method, apparatus, device and storage medium for executing distributed computing task

Legal Events

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