CN114500379A - Message transmission method, device, equipment and storage medium - Google Patents

Message transmission method, device, equipment and storage medium Download PDF

Info

Publication number
CN114500379A
CN114500379A CN202210153085.1A CN202210153085A CN114500379A CN 114500379 A CN114500379 A CN 114500379A CN 202210153085 A CN202210153085 A CN 202210153085A CN 114500379 A CN114500379 A CN 114500379A
Authority
CN
China
Prior art keywords
client
target
address
server
node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210153085.1A
Other languages
Chinese (zh)
Inventor
邓夫伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiqi Chengdu Technology Co ltd
Original Assignee
Jiqi Chengdu 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 Jiqi Chengdu Technology Co ltd filed Critical Jiqi Chengdu Technology Co ltd
Priority to CN202210153085.1A priority Critical patent/CN114500379A/en
Publication of CN114500379A publication Critical patent/CN114500379A/en
Pending legal-status Critical Current

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
    • H04L45/745Address table lookup; Address filtering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • 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

Landscapes

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

Abstract

The application provides a message transmission method, a message transmission device, message transmission equipment and a message transmission storage medium, and belongs to the technical field of protocol transmission. The method comprises the following steps: obtaining a message sent by a target client, and analyzing the message to obtain client information, wherein the client information comprises at least one of the following items: protocol version information, client address information and client account information; determining a target back-end address corresponding to the target client based on the dynamic routing strategy and the address distribution weight, wherein the target back-end address is a node address in the server; and establishing communication connection between the target client and the target back-end address, and sending the message to the target back-end address. The method and the device can avoid corresponding configuration on the client when the server is updated, and further can improve the efficiency of connection configuration.

Description

Message transmission method, device, equipment and storage medium
Technical Field
The present application relates to the field of protocol transmission technologies, and in particular, to a method, an apparatus, a device, and a storage medium for transmitting a packet.
Background
In a scenario of communication between a client and a server, information interaction between a plurality of clients and different nodes corresponding to the server is usually performed, and when a new client is accessed or the server is updated, corresponding configuration between the client and the server is required.
In the technical scheme adopted in the prior art, connection configuration is generally performed manually based on a client, so that normal communication is maintained between an accessed new client and a server or between the client and an updated server.
However, in practical applications, since the clients are usually distributed in a scene that cannot be directly operated, the configuration of the clients cannot be directly implemented by the user, so that the accessed new client or the updated client cannot keep communication with the server.
Disclosure of Invention
The present application aims to provide a method, an apparatus, a device and a storage medium for transmitting a packet, which can avoid performing corresponding configuration on a client when a server performs update, and can further improve the efficiency of connection configuration.
The embodiment of the application is realized as follows:
in one aspect of the embodiments of the present application, a method for transmitting a packet is provided, where the method includes:
obtaining a message sent by a target client, and analyzing the message to obtain client information, wherein the client information comprises at least one of the following items: protocol version information, client address information and client account information;
determining a target back-end address corresponding to the target client based on the dynamic routing strategy and the address distribution weight, wherein the target back-end address is a node address in the server;
and establishing communication connection between the target client and the target back-end address, and sending the message to the target back-end address.
Optionally, determining a target backend address corresponding to the target client based on the preconfigured dynamic routing policy and the address assignment weight includes:
filtering the node address in the server according to the dynamic routing strategy to obtain a filtered node address;
and determining a target back-end address corresponding to the target client from the filtered node addresses based on the address distribution weight.
Optionally, filtering the node address in the server according to the dynamic routing policy to obtain a filtered node address, including:
determining a dynamic routing strategy in the current state;
determining a target node address according to a mapping relation between a target client and at least one node address in a dynamic routing strategy in a current state;
and filtering the node addresses except the target node address in the server to obtain the filtered node addresses.
Optionally, the method further comprises:
acquiring current state information, wherein the state information comprises at least one of the following: the current time, the connection relationship between the server and the client;
and if the current state information meets the preset state jump condition, updating the dynamic routing strategy.
Optionally, after establishing the connection between the target client and the target backend address, the method further includes:
and recording and storing the corresponding relation between the target client and the target back-end address.
Optionally, after obtaining the message sent by the target client, the method further includes:
judging whether a corresponding relation between a target client and a target back-end address is stored or not;
and if so, sending the message to the target back-end address.
Optionally, the method further comprises:
and responding to the gray level test instruction, and performing gray level test with a plurality of clients connected with the gateway.
In another aspect of the embodiments of the present application, a device for transmitting a packet is provided, where the device includes: the system comprises an acquisition analysis module, an address determination module and a connection transmission module;
the acquisition and analysis module is used for acquiring a message sent by a target client and analyzing the message to obtain client information, wherein the client information comprises at least one of the following items: protocol version information, client address information and client account information;
the address determining module is used for determining a target back-end address corresponding to the target client based on the dynamic routing strategy and the address distribution weight, wherein the target back-end address is a node address in the server;
and the connection transmission module is used for establishing communication connection between the target client and the target back-end address and sending the message to the target back-end address.
Optionally, the address determining module is specifically configured to filter the node address in the server according to the dynamic routing policy, so as to obtain a filtered node address; and determining a target back-end address corresponding to the target client from the filtered node addresses based on the address distribution weight.
Optionally, the address determining module is specifically configured to determine a dynamic routing policy in a current state; determining a target node address according to a mapping relation between a target client and at least one node address in a dynamic routing strategy in a current state; and filtering the node addresses except the target node address in the server to obtain the filtered node addresses.
Optionally, the obtaining and parsing module is further configured to obtain current state information, where the state information includes at least one of the following: the current time, the connection relationship between the server and the client; and if the current state information meets the preset state jump condition, updating the dynamic routing strategy.
Optionally, the connection transmission module is further configured to record and store a corresponding relationship between the target client and the target backend address.
Optionally, the connection transmission module is further configured to determine whether a corresponding relationship between the target client and the target backend address is stored; and if so, sending the message to the target back-end address.
Optionally, the apparatus further comprises: receiving a test module; and the receiving test module is specifically used for responding to the gray test instruction and carrying out gray test on a plurality of clients connected with the gateway.
In another aspect of the embodiments of the present application, there is provided a computer device, including: the message transmission method comprises a memory and a processor, wherein a computer program capable of running on the processor is stored in the memory, and the steps of the message transmission method are realized when the processor executes the computer program.
In another aspect of the embodiments of the present application, a computer-readable storage medium is provided, where a computer program is stored on the storage medium, and when the computer program is executed by a processor, the steps of the method for transmitting a message are implemented.
The beneficial effects of the embodiment of the application include:
in the message transmission method, the message transmission device, the message transmission equipment and the message transmission storage medium provided by the embodiment of the application, a message sent by a target client can be acquired, and the message is analyzed to obtain client information; determining a target back-end address corresponding to the target client based on the dynamic routing strategy and the address distribution weight, wherein the target back-end address is a node address in the server; and establishing communication connection between the target client and the target back-end address, and sending the message to the target back-end address. The target back-end address corresponding to the target client can be determined based on the dynamic routing strategy and the address distribution weight through the server, so that when the server is updated or a new client is accessed, the server performs corresponding configuration change, the configuration through the client is avoided, and the efficiency of connection configuration can be improved; in addition, clients with different protocol versions can be connected with the server node through the same gateway, and the integrity of the whole system is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is a schematic view of an application scenario of a message transmission method according to an embodiment of the present application;
fig. 2 is a first schematic flow chart of a message transmission method according to an embodiment of the present application;
fig. 3 is a second flowchart illustrating a message transmission method according to an embodiment of the present application;
fig. 4 is a third schematic flowchart of a message transmission method according to an embodiment of the present application;
fig. 5 is a schematic illustration showing node filtering provided in the embodiment of the present application;
fig. 6 is a fourth schematic flowchart of a message transmission method according to an embodiment of the present application;
fig. 7 is a fifth flowchart illustrating a transmission method of a packet according to an embodiment of the present application;
fig. 8 is a schematic overall flow chart of a message transmission method according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a message transmission apparatus according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a computer device 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. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. 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.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
In the description of the present application, it is noted that the terms "first", "second", "third", and the like are used merely for distinguishing between descriptions and are not intended to indicate or imply relative importance.
The following specifically explains an actual application scenario of the packet transmission method provided in the embodiment of the present application.
Fig. 1 is a schematic view of an application scenario of a message transmission method provided in an embodiment of the present application, please refer to fig. 1, where the scenario may include: the server 120 is provided with a plurality of server nodes, addresses of the server nodes are different, and the plurality of clients 110 can be connected with the server 120 through communication and can be connected with the corresponding server nodes through gateways.
The client 110 may specifically be a terminal device, such as: the terminal devices may be networked and connected to the gateway in the server in a networked manner.
The server 120 may specifically be a server disposed at a cloud, and may be a distributed server cluster, or a single server, etc., in fig. 1, taking the server cluster as an example, in the server 120, a plurality of addresses are distributed, each address represents one server node, and after establishing a connection with the server, the client 110 may access one or more server nodes therein. It should be noted that the node may specifically be a different child node in one server, or may also be a different child server in a distributed server cluster (in fig. 1, a different child server in the distributed server cluster is taken as an example), which is not specifically limited herein and is collectively represented as a server node.
The gateway may be a virtual gateway disposed in the server, or may also be an entity gateway connected to the server, which is not specifically limited herein, and all functions of connection establishment and weight assignment may be implemented.
In this scenario, the client 110 and the server 120 may be connected through a gateway, and the gateway may establish a connection relationship between the client 110 and a corresponding server node, and may perform weight assignment and the like for a plurality of server nodes.
The following specifically explains a specific implementation process of the message transmission method provided in the embodiment of the present application.
Fig. 2 is a first schematic flow chart of a message transmission method according to an embodiment of the present application, please refer to fig. 2, where the method includes:
s210: and acquiring a message sent by a target client, and analyzing the message to obtain client information.
Wherein the client information comprises at least one of: protocol version information, client address information, and client account information.
Optionally, an execution main body of the method may be the server, and the server may obtain, through network connection, the packet sent by the target client through the gateway.
The target client may be any one of a plurality of clients connected to the server, and the packet may be data information sent by the target client, may be encrypted data or plaintext data, and may be specifically set according to a requirement in an actual scene.
After the server obtains the message sent by the target client, the message can be analyzed. If the message is plaintext data, the message can be directly analyzed based on plaintext content; if the message is encrypted data, the encrypted data can be decrypted and then analyzed. Client information can be obtained based on a preset analysis mode.
In the client information, the protocol version information may specifically be a version of MQTT (Message Queuing Telemetry Transport) protocol; the client address information may be an ID (Identity document) of the client, and specifically may be an IP (Internet Protocol) address, or other means for representing the client Identity information; the client account information may be identification information such as a user name set by the user.
The client information can be stored in the message, and after the client sends the message to the server, the server can obtain the client information through a preset analysis mode.
It should be noted that the message may specifically be an MQTT connection message, which is a message used for establishing a connection with a server node, and the established connection may specifically be a TCP (Transmission Control Protocol) connection.
S220: and determining a target back-end address corresponding to the target client based on the dynamic routing strategy and the address distribution weight.
And the target back-end address is a node address in the server.
Optionally, both the dynamic routing policy and the address assignment weight may be configured in the server in advance, where the dynamic routing policy may be updated over time or in a connection state, etc. For example, the policy may indicate a correspondence of the target client to the at least one server node at different times.
If the target client side has a corresponding relation with a certain server node, the target client side can be in communication connection and data interaction with the server node. It should be noted that the correspondence may be a correspondence between a target client and one server node, or may be a correspondence between a target client and a plurality of server nodes.
It should be noted that the client identifier may be specifically determined based on the client information, and the specific record in the dynamic routing policy may be a correspondence between the client identifier and the server node.
For example: at time point 1, client a may correspond to server node a, server node b, and server node c; at time point 2, client a may correspond to server node d and server node e.
The address assignment weight may be a duty-ratio weight of communications between the client and the plurality of server nodes in the same correspondence.
For example: the client A corresponds to a server node a, a server node b and a server node c, wherein the weight of the server node a is 0.5, the weight of the server node b is 0.3, and the weight of the server node c is 0.2; different server nodes can show different address distribution weights, and the client can communicate with the plurality of server nodes according to the weight proportion in the connection establishment and the transmission process of message information.
It should be understood that, when the correspondence is a correspondence of a target client to one server node, the above-described address assignment weight is fixed to 1.
It should be noted that, based on the above manner, clients configured with different versions of MQTT protocol may be connected to the server node based on the same gateway, for example: the protocol version of the MQTT protocol of the client C is 1.0, and the protocol version of the MQTT protocol of the client D is 2.0; based on the strategy, the client C can establish connection with a server node f supporting the 1.0 protocol version in the server; and enabling the client D to establish connection with a server node g supporting the 2.0 protocol version in the server.
Optionally, after determining the client information of the target client, the above calculation processing may be performed based on the dynamic routing policy and the address assignment weight, so as to obtain a target back-end address corresponding to the target client, where the target back-end address is also a node address of a server node corresponding to the client.
It should be noted that, in different states, the dynamic routing policy may establish a corresponding relationship based on different client information, for example: at time point 3, a connection relationship between the client with the protocol version number of 3 and the client ID of client-a and the corresponding server node may be established.
S230: and establishing communication connection between the target client and the target back-end address, and sending the message to the target back-end address.
Optionally, after the target backend address is determined, a communication connection between the target client and the target backend address may be established, and the packet received by the gateway may be sent to the target backend address, that is, to the corresponding server node.
In the message transmission method provided by the embodiment of the application, a message sent by a target client can be acquired, and the message is analyzed to obtain client information; determining a target back-end address corresponding to the target client based on the dynamic routing strategy and the address distribution weight, wherein the target back-end address is a node address in the server; and establishing communication connection between the target client and the target back-end address, and sending the message to the target back-end address. The target back-end address corresponding to the target client can be determined based on the dynamic routing strategy and the address distribution weight through the server, so that when the server is updated or a new client is accessed, the server performs corresponding configuration change, the configuration through the client is avoided, and the efficiency of connection configuration can be improved; in addition, clients with different protocol versions can be connected with the server node through the same gateway, and the integrity of the whole system is improved.
Another specific implementation process of the message transmission method provided in the embodiment of the present application is explained below.
Fig. 3 is a second flowchart of a packet transmission method according to an embodiment of the present application, and please refer to fig. 3, where determining a target backend address corresponding to a target client based on a preconfigured dynamic routing policy and address assignment weight includes:
s310: and filtering the node address in the server according to the dynamic routing strategy to obtain the filtered node address.
Optionally, the server may be provided with a plurality of nodes, and after determining client information of the target client, the corresponding dynamic routing policy may be determined based on the client information, and then the target server node may be determined according to a correspondence between the target client and the server node in the dynamic routing policy, where the target server node may be a server node corresponding to the target client in the dynamic routing policy.
S320: and determining a target back-end address corresponding to the target client from the filtered node addresses based on the address distribution weight.
Optionally, after the filtered node addresses are obtained, the distribution weight of each address may be calculated and determined based on the address distribution weights, and then the target back-end address corresponding to the target client may be obtained.
Another specific implementation process of the message transmission method provided in the embodiment of the present application is specifically explained below.
Fig. 4 is a third schematic flow chart of a packet transmission method according to an embodiment of the present application, and please refer to fig. 4, where filtering a node address in a server according to a dynamic routing policy to obtain a filtered node address includes:
s410: and determining the dynamic routing strategy in the current state.
Optionally, the dynamic routing policy is constantly changing, and the dynamic routing policy in the current state may be determined before address filtering is performed based on the dynamic routing policy.
Specifically, whether the current dynamic routing strategy is changed or not can be judged, and if the current dynamic routing strategy is not changed, calculation can be carried out according to the dynamic routing strategy in the current state; in contrast, if the dynamic routing policy is changed, calculation may be performed according to the changed dynamic routing policy.
Optionally, when the dynamic routing policy changes, it may be determined whether a condition of state hopping is satisfied, and if so, the change may be implemented; if not, the strategy is continuously kept and is not changed.
S420: and determining the target node address according to the mapping relation between the target client and at least one node address in the dynamic routing strategy in the current state.
Optionally, after determining the dynamic routing policy in the current state, the mapping relationship between the target client and the at least one node address in the current state may be determined based on the client information, where the mapping relationship may be stored in a preset mapping table, or may also be calculated based on a preconfigured mapping algorithm, which is not limited herein.
Based on the mapping relationship, a target node address may be determined, wherein the target node address may be a node address that may be selected as a target client connection in a current state among the plurality of nodes of the server.
S430: and filtering the node addresses except the target node address in the server to obtain the filtered node addresses.
Optionally, after the destination node address is determined, the node addresses of other server nodes except the node address of the destination server node may be deleted and filtered from all the server node addresses, so as to obtain the node address of the destination server node, where the node addresses are the filtered node addresses.
The following explains a specific process of filtering nodes in the embodiment of the present application based on a specific flowchart.
Fig. 5 is a schematic diagram illustrating node filtering according to an embodiment of the present application, please refer to fig. 5, and fig. 5 illustrates a filtering process of a node in a server.
Wherein, a in fig. 5 represents all nodes (node a-node e) in the server, B in fig. 5 represents target routing nodes (node a-node C) determined from all nodes based on the dynamic routing policy, C in fig. 5 represents target routing nodes remaining after the filtering is completed, and the target client can establish a connection relationship with these target routing nodes.
Next, a further specific implementation process of the message transmission method provided in the embodiment of the present application is specifically explained.
Fig. 6 is a fourth schematic flowchart of a message transmission method according to an embodiment of the present application, please refer to fig. 6, where the method further includes:
s610: and acquiring current state information.
Wherein the status information includes at least one of: the current time, the connection relationship between the server and the client.
Alternatively, the current state may be a corresponding state of the dynamic routing policy, and the current state information may be state information that causes the dynamic routing policy to change, for example: the current time, the connection relationship between the server and the client.
Specifically, different dynamic routing strategies may be provided at different times; or, different dynamic routing policies are specified under different connection relationships between the server and the client.
S620: and if the current state information meets the preset state jump condition, updating the dynamic routing strategy.
After the current information is obtained, whether the current state information meets a preset state skipping condition can be judged, and if not, the dynamic routing strategy is kept unchanged; in contrast, if the dynamic routing policy is satisfied, the dynamic routing policy may be updated, and specifically, the correspondence between the target client and the server node, the address assignment weight, and the like may be updated, which is not limited herein.
The following explains a further specific implementation process of the message transmission method provided in the embodiment of the present application.
Fig. 7 is a fifth flowchart of a message transmission method provided in an embodiment of the present application, and please refer to fig. 7, where after a message sent by a target client is acquired, the method further includes:
s710: and judging whether the corresponding relation between the target client and the target back-end address is stored.
Optionally, after establishing the connection between the target client and the target backend address, the method further includes: and recording and storing the corresponding relation between the target client and the target back-end address.
It should be noted that, after the server establishes a connection relationship between the client and the server node based on the gateway, the server may record and store a corresponding relationship between the target client and the target backend address. When the corresponding relation is recorded and stored, because the routing strategy is dynamically changeable, the corresponding state can be recorded at the same time, and when the connection is reestablished, the message forwarding work can be realized only if the condition is the same as the recorded state.
After the message sent by the target client is obtained, it may be determined whether the corresponding relationship between the target client and the target backend address is stored, and if the corresponding relationship is not stored, it may be determined that the client establishes a connection relationship with the server for the first time, and the steps of S210-S230 may be executed.
S720: and if so, sending the message to the target back-end address.
Optionally, if the information is stored, it indicates that the client is connected to the corresponding server node, and may obtain the correspondence between the target client and the target backend address, and directly forward the packet sent by the client to the target backend address, that is, the corresponding server node.
Optionally, when a new client accesses the server, or the server itself performs version update, corresponding configuration modification may be performed on the gateway in the server, so as to update the configuration such as the connection relationship or the weight between the client and the server node, and the client does not need to be configured correspondingly.
Optionally, the method further comprises: and responding to the gray level test instruction, and performing gray level test with a plurality of clients connected with the gateway.
It should be noted that the grayscale test may specifically be a connection test performed after the version of the server is updated, and the grayscale test instruction may be generated by being triggered by a user, so that the grayscale test may be performed with a plurality of clients connected to the gateway to determine whether the connection between each client and the server is normal.
That is, when the server MQTT cluster version is iterated or migrated, the gray test can be performed according to the client connection information stored in the gateway, and the migration can be smooth without changing any configuration by the client.
The configuration may specifically refer to a connection configuration between the client and the corresponding server node.
Optionally, during the gray scale test or during the actual application, the gateway may monitor a local port of the client, and when the local port sends a packet, the gateway may analyze the protocol content based on the protocol specification.
The following explains a specific implementation process of the message transmission method provided in the embodiment of the present application based on an overall flowchart.
Fig. 8 is a schematic overall flow chart of a message transmission method according to an embodiment of the present application, please refer to fig. 8, where the method includes:
s810: and acquiring a message sent by the target client. Step S820 is performed.
S820: and judging whether the corresponding relation between the target client and the target back-end address is stored. If yes, go to step S830; if not, go to step S840.
S830: and sending the message to a target back-end address. Step S860 is performed.
S840: and analyzing the message to obtain client information. Step S850 is performed.
S850: and determining a target back-end address corresponding to the target client based on the dynamic routing strategy and the address distribution weight. Step S860 is performed.
S860: and establishing communication connection between the target client and the target back-end address. S830 is performed.
It should be noted that the specific implementation process of the steps S810 to S860 has been correspondingly explained in the foregoing steps S210 to S230 and S710 to S720, and is not repeated herein.
The following describes apparatuses, devices, and storage media corresponding to the method for transmitting a packet provided by the present application, and specific implementation processes and technical effects thereof are described above and will not be described in detail below.
Fig. 9 is a schematic structural diagram of a message transmission apparatus according to an embodiment of the present application, please refer to fig. 9, where the apparatus includes: an acquisition and analysis module 910, an address determination module 920 and a connection transmission module 930;
the obtaining and analyzing module 910 is configured to obtain a message sent by a target client, and analyze the message to obtain client information, where the client information includes at least one of the following: protocol version information, client address information and client account information;
an address determining module 920, configured to determine a target backend address corresponding to the target client based on the dynamic routing policy and the address allocation weight, where the target backend address is a node address in the server;
the connection transmission module 930 is configured to establish a communication connection between the target client and the target backend address, and send the message to the target backend address.
Optionally, the address determining module 920 is specifically configured to filter the node address in the server according to the dynamic routing policy, so as to obtain a filtered node address; and determining a target back-end address corresponding to the target client from the filtered node addresses based on the address distribution weight.
Optionally, the address determining module 920 is specifically configured to determine a dynamic routing policy in a current state; determining a target node address according to the mapping relation between a target client and at least one node address in a dynamic routing strategy in the current state; and filtering the node addresses except the target node address in the server to obtain the filtered node addresses.
Optionally, the obtaining and parsing module 910 is further configured to obtain current state information, where the state information includes at least one of: the current time, the connection relationship between the server and the client; and if the current state information meets the preset state jump condition, updating the dynamic routing strategy.
Optionally, the transmission module 930 is further configured to record and store a corresponding relationship between the target client and the target backend address.
Optionally, the connection transmitting module 930 is further configured to determine whether a corresponding relationship between the target client and the target backend address is stored; and if so, sending the message to the target back-end address.
Optionally, the apparatus further comprises: receiving a test module; and the receiving test module is specifically used for responding to the gray test instruction and carrying out gray test on a plurality of clients connected with the gateway.
The above-mentioned apparatus is used for executing the method provided by the foregoing embodiment, and the implementation principle and technical effect are similar, which are not described herein again.
These above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more Application Specific Integrated Circuits (ASICs), or one or more microprocessors, or one or more Field Programmable Gate Arrays (FPGAs), etc. For another example, when one of the above modules is implemented in the form of a Processing element scheduler code, the Processing element may be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
Fig. 10 is a schematic structural diagram of a computer device according to an embodiment of the present application, and referring to fig. 10, the computer device includes: the message transmission method comprises a memory 100 and a processor 200, wherein a computer program capable of running on the processor 200 is stored in the memory 100, and when the processor 200 executes the computer program, the steps of the message transmission method are realized.
Optionally, the computer device may specifically be the server described above.
In another aspect of the embodiments of the present application, a computer-readable storage medium is further provided, where a computer program is stored on the storage medium, and when the computer program is executed by a processor, the steps of the method for transmitting a message are implemented.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
The above description is only a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and changes may be made to the present application by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (10)

1. A method for transmitting a message, the method comprising:
obtaining a message sent by a target client, and analyzing the message to obtain client information, wherein the client information comprises at least one of the following items: protocol version information, client address information and client account information;
determining a target back-end address corresponding to the target client based on a dynamic routing strategy and address distribution weight, wherein the target back-end address is a node address in a server;
and establishing communication connection between the target client and the target back-end address, and sending the message to the target back-end address.
2. The method of claim 1, wherein the determining the target backend address corresponding to the target client based on the dynamic routing policy and the address assignment weight comprises:
filtering the node address in the server according to the dynamic routing strategy to obtain a filtered node address;
and determining a target back-end address corresponding to the target client from the filtered node addresses based on address distribution weight.
3. The method of claim 2, wherein filtering the node addresses in the server according to the dynamic routing policy to obtain filtered node addresses comprises:
determining a dynamic routing strategy in the current state;
determining a target node address according to the mapping relation between the target client and at least one node address in the dynamic routing strategy in the current state;
and filtering the node addresses except the target node address in the server to obtain the filtered node addresses.
4. The method of claim 1, wherein the method further comprises:
acquiring current state information, wherein the state information comprises at least one of the following: the current time, the connection relation between the server and the client;
and when the current state information meets a preset state jump condition, updating the dynamic routing strategy.
5. The method of claim 1, wherein after the establishing the connection of the target client with the target backend address, the method further comprises:
and recording and storing the corresponding relation between the target client and the target back-end address.
6. The method of claim 5, wherein after obtaining the message sent by the target client, the method further comprises:
judging whether the corresponding relation between the target client and the target back-end address is stored or not;
and if so, sending the message to the target back-end address.
7. The method of any one of claims 1-6, further comprising:
responding to a gray scale test instruction, and performing gray scale test on a plurality of clients connected with the gateway.
8. An apparatus for transmitting a message, the apparatus comprising: the system comprises an acquisition analysis module, an address determination module and a connection transmission module;
the acquisition and analysis module is used for acquiring a message sent by a target client and analyzing the message to obtain client information, wherein the client information comprises at least one of the following items: protocol version information, client address information and client account information;
the address determination module is used for determining a target back-end address corresponding to the target client based on a dynamic routing strategy and address distribution weight, wherein the target back-end address is a node address in a server;
and the connection transmission module is used for establishing communication connection between the target client and the target back-end address and sending the message to the target back-end address.
9. A computer device, comprising: memory in which a computer program is stored which is executable on the processor, a processor which, when executing the computer program, carries out the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202210153085.1A 2022-02-18 2022-02-18 Message transmission method, device, equipment and storage medium Pending CN114500379A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210153085.1A CN114500379A (en) 2022-02-18 2022-02-18 Message transmission method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210153085.1A CN114500379A (en) 2022-02-18 2022-02-18 Message transmission method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114500379A true CN114500379A (en) 2022-05-13

Family

ID=81482412

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210153085.1A Pending CN114500379A (en) 2022-02-18 2022-02-18 Message transmission method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114500379A (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013004134A1 (en) * 2011-07-05 2013-01-10 中兴通讯股份有限公司 A routing method, node and system for p2p network
US20130102308A1 (en) * 2011-10-24 2013-04-25 Basavaraj Patil Method and apparatus for dynamic agent selection in a communications network
CN105827446A (en) * 2016-03-31 2016-08-03 深圳市金溢科技股份有限公司 Intelligent traffic API gateway and intelligent traffic service system
CN108156038A (en) * 2017-12-29 2018-06-12 广东欧珀移动通信有限公司 Ask distribution method, device, access gateway and storage medium
CN110247848A (en) * 2018-03-09 2019-09-17 华为技术有限公司 Send method, the network equipment and the computer readable storage medium of message
CN110308983A (en) * 2019-04-19 2019-10-08 中国工商银行股份有限公司 Method for balancing resource load and system, service node and client
CN111090452A (en) * 2019-11-11 2020-05-01 福建天泉教育科技有限公司 Service environment switching method and computer-readable storage medium
CN111885098A (en) * 2020-06-03 2020-11-03 中邮消费金融有限公司 Proxy access method, system and computer equipment for object storage cluster
CN112153155A (en) * 2020-09-28 2020-12-29 平安数字信息科技(深圳)有限公司 Service request method, device, computer equipment and medium in server cluster

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013004134A1 (en) * 2011-07-05 2013-01-10 中兴通讯股份有限公司 A routing method, node and system for p2p network
US20130102308A1 (en) * 2011-10-24 2013-04-25 Basavaraj Patil Method and apparatus for dynamic agent selection in a communications network
CN105827446A (en) * 2016-03-31 2016-08-03 深圳市金溢科技股份有限公司 Intelligent traffic API gateway and intelligent traffic service system
CN108156038A (en) * 2017-12-29 2018-06-12 广东欧珀移动通信有限公司 Ask distribution method, device, access gateway and storage medium
CN110247848A (en) * 2018-03-09 2019-09-17 华为技术有限公司 Send method, the network equipment and the computer readable storage medium of message
CN110308983A (en) * 2019-04-19 2019-10-08 中国工商银行股份有限公司 Method for balancing resource load and system, service node and client
CN111090452A (en) * 2019-11-11 2020-05-01 福建天泉教育科技有限公司 Service environment switching method and computer-readable storage medium
CN111885098A (en) * 2020-06-03 2020-11-03 中邮消费金融有限公司 Proxy access method, system and computer equipment for object storage cluster
CN112153155A (en) * 2020-09-28 2020-12-29 平安数字信息科技(深圳)有限公司 Service request method, device, computer equipment and medium in server cluster

Similar Documents

Publication Publication Date Title
CN100484125C (en) Answering method to address inquire and appts. thereof
US8892768B2 (en) Load balancing apparatus and load balancing method
US7992201B2 (en) Dynamic network tunnel endpoint selection
CN111567010B (en) Method, system, and storage medium for managing capacity of OPC UA server
US9473369B2 (en) Application topology based on network traffic
CN110166570B (en) Service session management method and device, and electronic device
JP4163697B2 (en) Load distribution system, real server, and load distribution method
RU2464722C2 (en) Method, device and system for distribution of messages
US20030093560A1 (en) Load balancer
KR20040071203A (en) System and method for downloading data using a proxy
CN110995656B (en) Load balancing method, device, equipment and storage medium
CN112751897B (en) Load balancing method, device, medium and equipment
JP2012118709A (en) Distribution system, storage capacity decision program, and storage capacity decision method
KR20230006479A (en) Load balancing of establishment of connections between groups of connector servers
CN112087327B (en) Information state acquisition method and apparatus, storage medium, and electronic apparatus
JP2003058376A (en) Distribution system, distribution server and its distribution method, and distribution program
JP5154313B2 (en) SIP message distribution method and SIP message distribution apparatus
CN116633934A (en) Load balancing method, device, node and storage medium
US20240259475A1 (en) Service scheduling method and apparatus, device, and computer-readable storage medium
US8180857B2 (en) Method for downloading file in parallel
JP5917678B1 (en) Information processing apparatus, method, and program
CN117499403A (en) Computing task scheduling method and device for computing power network
CN117311979A (en) Google remote procedure call load balancing system, method, device and medium
CN114500379A (en) Message transmission method, device, equipment and storage medium
JP5381247B2 (en) Load distribution device, load distribution method, load distribution program, and load distribution system

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