CN111654527B - Message receiving and transmitting method and device - Google Patents

Message receiving and transmitting method and device Download PDF

Info

Publication number
CN111654527B
CN111654527B CN202010396848.6A CN202010396848A CN111654527B CN 111654527 B CN111654527 B CN 111654527B CN 202010396848 A CN202010396848 A CN 202010396848A CN 111654527 B CN111654527 B CN 111654527B
Authority
CN
China
Prior art keywords
client
proxy server
proxy
clients
server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010396848.6A
Other languages
Chinese (zh)
Other versions
CN111654527A (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.)
WeBank Co Ltd
Original Assignee
WeBank 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 WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN202010396848.6A priority Critical patent/CN111654527B/en
Publication of CN111654527A publication Critical patent/CN111654527A/en
Application granted granted Critical
Publication of CN111654527B publication Critical patent/CN111654527B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0668Management of faults, events, alarms or notifications using network fault recovery by dynamic selection of recovery network elements, e.g. replacement by the most appropriate element after failure
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/07User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail characterised by the inclusion of specific contents
    • H04L51/18Commands or executable codes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/562Brokering proxy services

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention relates to the field of financial science and technology (Fintech), and discloses a method and a device for message transmission and reception, wherein the method comprises the following steps: the first proxy server determines group information of the first client, the first proxy server acquires proxy conditions of the second proxy server from the registration center, the second proxy server currently proxied clients comprise second clients with the group information, the proxy conditions are used for indicating the conditions of the second clients, and the first proxy server determines a third proxy server for proxy of the first client according to the proxy conditions of the second proxy server. The invention enables the receiving and transmitting messages with the same group of information to be distributed on different proxy servers relatively uniformly, and reduces the business influence caused by the failure of the proxy servers.

Description

Message receiving and transmitting method and device
Technical Field
The invention relates to the technical field of financial science and technology (Fintech), in particular to a method and a device for message transmission and reception.
Background
With the development of computer technology, more and more technologies (such as distributed architecture, cloud computing or big data) are applied in the financial field, and the traditional financial industry is gradually changed to the financial technology, so that the big data technology is not exceptional, but the big data technology is also required to be higher due to the requirements of security and real-time performance of the financial and payment industries.
At present, for different types of clients to access, due to the difference of languages, the messages are generally sent and received through a proxy server. The client side carries out message sending and receiving through the proxy server specifically comprises the following steps: the proxy servers with the same data center identification are preferentially determined to be connected, and when the proxy servers with the same data center identification do not exist, other proxy servers without the same data center identification are selected to be connected.
According to the scheme, the client sides of the same group preferably determine the proxy server under the identification of the data center, so that the client sides of the same group, namely the client sides of the same subsystem, are likely to be connected to the same proxy server, and when the proxy server fails, all the client sides of the group and even the subsystem are affected, and obviously, the service is greatly affected.
Disclosure of Invention
The application provides a method and a device for message sending and receiving, which are used for solving the problem of how to improve the uniformity of sending and receiving messages distributed to different proxy servers.
In a first aspect, an embodiment of the present application provides a method for messaging, including:
The method comprises the steps that a first proxy server determines group information of a first client; the first client is any one of the clients; each client receives and transmits information through each proxy server; wherein, the group information is at least determined according to the subsystem to which the client belongs;
the first proxy server acquires the proxy status of the second proxy server from the registry; the second proxy server comprises a second client with the group information in the clients which are currently proxied; the proxy status is used to indicate a status of the second client;
And the first proxy server determines a third proxy server for proxy of the first client according to the proxy condition of the second proxy server.
According to the scheme, the proxy conditions on other proxy servers are acquired through the registration center, and the distribution of the clients is adjusted, so that the clients of the same group are prevented from being concentrated on individual proxy servers, the clients with the same group information are distributed on different proxy servers relatively uniformly, and the service influence caused by the faults of the proxy servers is reduced.
Optionally, the determining, by the first proxy server, the group information to which the first client belongs includes:
the first proxy server receives a proxy recommendation request sent by the first client, wherein the proxy recommendation request comprises group information for indicating the first client to belong to; the agent recommendation request is sent by the first client before receiving and sending a message; or alternatively
And the first proxy server determines the group information of the first client from the transmitted and received messages of the first client which is currently proxied.
According to the scheme, the group information is contained in the proxy recommendation request sent by the client in the connection establishment stage, so that the message sent and received by the client is accurate to the specific group information, and the proxy server can efficiently recommend the target server to the client according to the group information. In the operation stage, the group information of the first client is determined so that the transmitted and received messages with the same group information are relatively evenly distributed on different proxy servers, and the business influence caused by the failure of the proxy servers is reduced.
Optionally, the determining, by the first proxy server, a third proxy server that proxies the first client according to the proxy condition of the second proxy server includes:
and the first proxy server determines the third proxy server according to the number of second clients with the same receiving and transmitting attribute as the first clients on the second proxy server.
According to the scheme, the number of the second clients with the same transceiving attributes as the first clients is determined, so that the third generation server enables the transceiving messages with the same transceiving attributes to be distributed to different proxy servers relatively evenly.
Optionally, before determining to proxy the third generation server of the first client, the method further includes:
the first proxy server determines the number of fourth proxy servers with the same machine room identification as the first proxy server in the second proxy server and the number of third clients with the same receiving and transmitting attribute as the first client in the second client proxied by the fourth proxy server;
The first proxy server determines a proxy threshold according to the number of the fourth proxy servers and the number of the third clients;
The first proxy server determines the number of the fourth clients which are provided with the group information and have the same transceiving attribute with the first client and are of the self proxy;
and the first proxy server determines the proxy server needing to be changed for the first client and the number of the first client needing to be changed according to the proxy threshold and the number of the fourth client.
According to the scheme, the proxy server of the first client needs to be changed and the number of the clients needs to be redirected are determined through the specific strategy, so that the clients needing to change the proxy server proxy of the first client are more reasonable through quantification, and the uniformity of the distribution of the received and transmitted messages to different proxy servers is improved.
Optionally, the determining the proxy server of the first client to be changed and the number of the first clients to be changed includes:
When avg > =2 and currentnum-avg > avg/2, redirecting avg/2 clients with the same transceiving attribute of the proxy server proxy to realize the quantity modification of the first client;
When avg <2, currentnum-avg >1, redirecting 1 client with the same receiving and transmitting attribute, which is proxied by the proxy server; wherein avg is a proxy threshold, and currentNum is the number of clients with the same transceiving attribute that are proxied by the current proxy server.
According to the scheme, the number of the clients needing to be changed is determined through the specific strategy, and the clients needing to be changed for the proxy server proxy of the first client are more reasonable through quantization, so that the uniformity of the distribution of the received and transmitted messages to different proxy servers is improved.
Optionally, the group information is determined at least according to a subsystem to which the client belongs, including:
clients belonging to the same subsystem and belonging to the same data center are determined to be the same group.
According to the scheme, the sub-system and the data center are used for carrying out fine-grained grouping on the client, so that the efficiency of message receiving and sending is improved.
In a second aspect, an embodiment of the present application provides a method for messaging, including:
The method comprises the steps that a first client receives information of a third generation server sent by a first proxy server; the third generation server is determined by the proxy condition of the second proxy server acquired by the first proxy server from the registration center; the second proxy server comprises a second client with the same group information as the first client in the clients which are currently proxied; the proxy status is used to indicate a status of the second client; the group information is determined at least according to the subsystem to which the client belongs;
The first client receives and transmits messages through the third generation server.
By the scheme, the clients with the same group of information are distributed on different proxy servers relatively uniformly, and business influence caused by the faults of the proxy servers is reduced.
Optionally, before the first client receives the information of the third generation server sent by the first proxy server, the method further includes:
The first client sends a proxy recommendation request to the first proxy server; the agent recommendation request includes group information indicating that the first client belongs to.
According to the scheme, the group information is contained in the proxy recommendation request sent by the client in the connection establishment stage, so that the message sent and received by the client is accurate to the specific group information, and the proxy server can efficiently recommend the target server to the client according to the group information.
In a third aspect, an embodiment of the present application provides a messaging apparatus, the apparatus including:
A determining module, configured to determine group information to which the first client belongs; the first client is any one of the clients; each client receives and transmits information through each proxy server; wherein, the group information is at least determined according to the subsystem to which the client belongs;
The acquisition module is used for acquiring the proxy condition of the second proxy server from the registration center; the second proxy server comprises a second client with the group information in the clients which are currently proxied; the proxy status is used to indicate a status of the second client;
and the processing module is used for determining a third generation server for proxy of the first client according to the proxy condition of the second proxy server.
Optionally, the determining module is specifically configured to:
Receiving a proxy recommendation request sent by the first client, wherein the proxy recommendation request comprises group information for indicating the first client to belong to; the agent recommendation request is sent by the first client before receiving and sending a message; or alternatively
And determining the group information of the first client from the currently proxied message sent by the first client.
Optionally, the processing module is specifically configured to:
and determining the third generation server according to the number of second clients with the same transceiving attribute as the first clients on the second proxy server.
Optionally, the processing module is further configured to:
Before determining a third generation server for proxy of the first client, determining a fourth proxy server with the same machine room identification as the first proxy server in the second proxy server and the number of third clients with the same receiving and transmitting attribute as the first client in the second client of the fourth proxy server proxy;
Determining a proxy threshold according to the number of the fourth proxy servers and the number of the third clients;
Determining the number of the fourth clients which are provided with the group information and have the same transceiving attribute with the first client and are of the self-agent;
And determining the proxy server of the first client needing to be changed and the number of the first client needing to be changed according to the proxy threshold and the number of the fourth client.
Optionally, the determining module is specifically configured to:
When avg > =2 and currentnum-avg > avg/2, redirecting avg/2 clients with the same transceiving attribute of the proxy server proxy to realize the quantity modification of the first client;
When avg <2, currentnum-avg >1, redirecting 1 client with the same receiving and transmitting attribute, which is proxied by the proxy server; wherein avg is a proxy threshold, and currentNum is the number of clients with the same transceiving attribute that are proxied by the current proxy server.
Optionally, the determining module is specifically configured to:
clients belonging to the same subsystem and belonging to the same data center are determined to be the same group.
In a fourth aspect, an embodiment of the present application provides a messaging apparatus, the apparatus including:
The receiving module is used for receiving the information of the third generation server sent by the first proxy server; the third generation server is determined by the proxy condition of the second proxy server acquired by the first proxy server from the registration center; the second proxy server comprises a second client with the same group information as the first client in the clients which are currently proxied; the proxy status is used to indicate a status of the second client; the group information is determined at least according to the subsystem to which the client belongs;
and the processing module is used for receiving and sending messages through the third generation server.
Optionally, the receiving module is further configured to:
before the first client receives information of a third proxy server sent by a first proxy server, sending a proxy recommendation request to the first proxy server; the agent recommendation request includes group information indicating that the first client belongs to.
Accordingly, an embodiment of the present invention further provides a computing device, including:
A memory for storing program instructions;
and the processor is used for calling the program instructions stored in the memory and executing the messaging method according to the obtained program.
Accordingly, embodiments of the present invention also provide a computer-readable nonvolatile storage medium including computer-readable instructions, which when read and executed by a computer, cause the computer to perform the above-described messaging method.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a system framework of a method for messaging provided by an embodiment of the present invention;
FIG. 2 is a flow chart of a method for messaging according to an embodiment of the present invention;
FIG. 3 is a diagram of a method for messaging according to an embodiment of the present invention;
FIG. 4 is a flow chart of a method for messaging according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a messaging device according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a messaging device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail below with reference to the accompanying drawings, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
First, some terms in the present application will be explained in order to be understood by those skilled in the art.
Client side: the message sending and receiving, the sending and receiving attribute of the client is pub, which means that the client is a message sending process, and the sending and receiving attribute of the client is sub, which means that the client is a message receiving process.
Proxy server: a messaging proxy server.
Configuration center: the address of the proxy server to which the client can connect is stored.
The registry: the data with which the proxy server is registered is stored.
In the prior art, the relative balance of the number of clients proxied by the proxy server is ensured based on a random algorithm. However, for a certain proxy server, such as proxy server a, only has the information of its own proxy status, but proxy server a does not have the information of the proxy status of other proxy services, so that the messages to be sent and received are easily concentrated on the same proxy server, and the proxy server is greatly affected when it fails.
Based on this, the embodiment of the present invention provides a method for messaging, which may be applied to a system architecture shown in fig. 1, where the system architecture includes a configuration center 100, a client 200, a proxy server 300, a registry 400, and a message queue server 500.
Wherein the proxy server 300 determines group information to which the client 200 belongs and acquires proxy status of each proxy server of the client having the same group information proxied from the registry 100. The proxy server 300 determines a proxy server of the proxy client based on the proxy status of each proxy server.
In one possible implementation, proxy server 300 receives a proxy recommendation request sent by client 200.
The proxy recommendation request includes group information indicating to which the client 200 belongs.
In another possible implementation, the proxy server 300 determines the group information to which the client belongs from the transceiving messages of the client that has been currently proxied.
The registry 400 receives proxy conditions of the proxy servers 300 and stores proxy data while providing an interface for querying the proxy conditions of each proxy server for the proxy server 300.
The message queue server 500 is used for storing messages sent and received by the client 200.
It should be noted that fig. 1 is only an example of a system architecture according to an embodiment of the present application, and the present application is not limited thereto in particular.
Based on the system architecture illustrated above, fig. 2 is a flow diagram corresponding to a method for messaging according to an embodiment of the present invention, as shown in fig. 2, where the method includes:
In step 201, the first proxy server determines group information to which the first client belongs.
It should be noted that, the first client is any one of the clients; each client receives and transmits information through each proxy server; wherein the group information is determined at least according to the subsystem to which the client belongs.
In step 202, the first proxy server obtains the proxy status of the second proxy server from the registry.
It should be noted that, the second proxy server includes the second client having the group information in the clients that have been currently proxied, and the proxy status is used to indicate the status of the second client.
In step 203, the first proxy server determines a third proxy server for proxy of the first client according to the proxy status of the second proxy server.
In the embodiment of the application, each proxy server reports the proxy condition of the proxy server to the registration center, the proxy server is uniformly stored by the registration center, and the registration center provides an interface of the proxy condition of each proxy server for the proxy server to inquire.
For example, the proxy server starts a timing task after starting, and reports the proxy status of the proxy server to the registration center at regular time.
Specifically, the report content includes: the cluster name to which the proxy server belongs, the proxy server name, the number of clients to which each group of the proxy belongs as the transmission/reception attribute, the number of clients to which each group of the proxy belongs as the reception attribute, and the like.
The embodiment of the application groups the clients before step 201.
Specifically, the group information is determined at least according to the subsystem to which the client belongs.
In one possible implementation, clients belonging to the same subsystem and belonging to the same data center are determined to be the same group.
For example, the group information is determined based on the subsystem to which the client belongs and the data center (DATA CENTER Node, DCN).
Specifically, as shown in fig. 3: the subsystem A and the subsystem B are respectively provided with 6 clients, wherein the clients of the subsystem A are respectively a client A1, a client A2, a client A3, a client A4, a client A5 and a client A6, and the clients of the subsystem A are respectively a client B1, a client B2, a client B3, a client B4, a client B5 and a client B6.
As can be seen from the figure, DCN1 and DCN2 also respectively include 6 clients in the dashed boxes, where the clients of DCN1 are respectively client A1, client A2, client A3, client B1, client B2, and client B3. The clients of DCN2 are client A4, client A5, client A6, client B4, client B5, and client B6, respectively.
Further, the group determined according to the subsystem a and DCN1 includes a client A1, a client A2, and a client A3; the group determined according to the subsystem A and the DCN2 comprises a client A4, a client A5 and a client A6; the group determined according to the subsystem B and the DCN1 comprises a client B1, a client B2 and a client B3; the group determined by subsystem B and DCN2 includes client B4, client B5, and client B6.
It should be noted that, the clients may be grouped according to the subsystem number, which is not specifically limited in the embodiment of the present application.
Further, the address list of the proxy server connected with the client and the address of the registry connected with the proxy server are configured in the configuration center in advance.
In one possible way, as shown in table one:
Key Value Description
proxyServerAddr Ip1:port1#IDC1;Ip2:port2#IDC2 Address of proxy server
proxyRegistryAddr Ip1:port1;Ip2:port2;Ip3:port3 Address of registry
The IDC1 is a machine room identifier of the machine room (INTERNET DATA CENTER, IDC) where Ip1 is located.
In one possible implementation manner, the first proxy server receives a proxy recommendation request sent by the first client.
It should be noted that, the agent recommendation request includes group information for indicating that the first client belongs to; the proxy recommendation request is sent by the first client before sending and receiving the message.
Specifically, before the first proxy server receives the proxy recommendation request sent by the first client, the first client selects the first proxy server to be queried so that the queried first proxy server determines the third proxy server.
Further, the first client obtains an address list of the connectable first proxy server from the configuration center, and selects the proxy server for query according to the IDC where the first client is located.
For example, the IDC where the first client is located is IDC1, and the proxy server belonging to IDC1 is preferentially found from the list returned by the configuration center to query.
In the embodiment of the application, when the IDC where the first client is located does not exist, the proxy server of other IDCs is randomly selected for inquiring.
In the embodiment of the present application, after the first proxy server receives the proxy recommendation request sent by the first client, in step 202, the first proxy server queries the registry for the proxy status of each proxy server that proxies the client with the same set of information.
Further, the query results are classified into a proxy condition on a proxy server of the same IDC as the first client, and a proxy condition on a proxy server of a different IDC than the first client.
Specifically, the first proxy server determines the third proxy server according to the number of second clients with the same transceiving attribute as the first clients on the second proxy server.
In the embodiment of the application, the proxy server with the least number of the group of the clients is selected to be returned from the proxy servers of the same IDC as the clients preferentially, and when the proxy server of the same IDC as the clients is not available, the proxy server with the least number of the group of the clients is selected to be returned from the proxy servers of other IDCs.
For example, the clients included in the group of clients determined by the subsystem a and the DCN1 are the client A1, the client A2, the client A3, the client A4, the client A5, and the client A6, respectively, that is, the group numbers corresponding to the group information of the 6 clients are all a-DCN1. And the receiving and transmitting attributes of the 6 clients are all sending messages. IDC1 includes three proxy servers, namely proxy server 1, proxy server 2 and proxy server 3. Specifically, the client A1 is connected to the proxy server 1, the client A2 is connected to the client A3 and the proxy server 2, and the client A4 is connected to the client A5 and the proxy server 3.
Further, when the newly added client A6 from IDC1 is to be added, the proxy server obtains the proxy status of each proxy server having the same set of information as the proxy server from the registry, and it can be seen that the proxy server with the smallest number of the set of clients of proxy a-DCN1 among the proxy servers of IDC1, which are the same as the client, is the proxy server 1, and returns the proxy server 1 as the target server.
For another example, the clients included in the group of clients determined by the subsystem B and the DCN2 are the client B1, the client B2, the client B3, the client B4, the client B5, and the client B6, respectively, that is, the group numbers corresponding to the group information of the 6 clients are all B-DCN2. And the receiving and transmitting properties of the 6 clients are all received messages. IDC3 includes three proxy servers, namely proxy server 4, proxy service 5, and proxy server 6. Specifically, the client B1 is connected to the proxy server 4, the client B2 is connected to the client B3 and the proxy server 5, and the client B4, the client B5, and the client B6 are connected to the proxy server 6.
Further, when the newly added client B7 from IDC2 is to be added, the proxy server obtains the proxy status of each proxy server having the same set of information as the proxy server from the registry, and it can be seen that the proxy server of IDC2 is the proxy server of the set of clients that does not have proxy B-DCN2 among the proxy servers of IDC2, however, the proxy server of IDC3 is the proxy server 4 with the least number of proxy B-DCN2 among the proxy servers of IDC3, and returns the proxy server 4 as the target server.
According to the scheme, the client establishes connection with the recommended proxy server according to the recommended result returned by the proxy server, so that the clients in the same group are relatively uniformly distributed on different proxy servers in the establishing stage.
The above describes the establishment of a connection phase with a relatively balanced distribution of clients having the same set of information to different proxy servers, and the following describes the specific procedure of a relatively balanced distribution of clients having the same set of information to different proxy servers during the run phase.
In the real-time example of the application, when the first proxy server runs, the first proxy server determines the group information of the first client from the received and transmitted messages of the first client which is currently proxied.
Specifically, the first proxy server determines the number of fourth proxy servers with the same machine room identification as the first proxy server in the second proxy server and the number of third clients with the same receiving and transmitting properties as the first client in the second clients proxied by the fourth proxy server;
the first proxy server determines a proxy threshold according to the number of the fourth proxy servers and the number of the third clients;
The first proxy server determines the number of the fourth clients which are provided with group information and have the same transceiving attribute with the first clients and are of the self proxy;
and the first proxy server determines the proxy server needing to be changed for the first client and the number of the first client needing to be changed according to the proxy threshold and the number of the fourth client.
The machine room identifies the IDC as described above.
In a possible implementation manner, when avg > =2 and currentnum-avg > avg/2, redirecting avg/2 clients with the same transceiving attribute, which are proxied by the proxy server, so as to realize the quantity modification of the first client;
when avg <2, currentnum-avg >1, redirecting 1 client with the same receiving and transmitting attribute, which is proxied by the proxy server; wherein, avg is a proxy threshold, currentNum is the number of clients with the same transceiving attribute that are proxied by the current proxy server;
Otherwise, it is determined that the proxy server is not redirected.
Note that, avg is a proxy threshold, currentNum is the number of clients with the same transceiving attribute that are proxied by the current proxy server.
For example, proxyM is IDC1, proxyM obtains proxy conditions on all proxy of IDC 1. proxyM for client X1, clients X2, proxyN for client X3, clients X4, proxyP for client X5, client X6 and client X7.
The clients X1, X2, X3, X4, X5, X6, and X7 have the same group information. IDC1 also contains a proxy server proxyQ, proxyS, proxyT, proxyR.
Further, the total number of clients (total) of the set of proxy servers for IDC1 is 7, the number of proxy for IDC1 is 7 (proxyNum), and the number of clients (currentNum) of the set of proxyP agents is 3 for proxyP, calculated from the proxy conditions of proxy servers proxyM, proxyN and proxyP. A determination proxyP is made as to whether it is necessary to redirect some of the clients by comparing proxyP the number of clients to the number of instances that each proxy should split on average.
It should be noted that, the specific formula of the number of examples to be divided into each proxy is: avg=total/proxyNum.
In the above example, avg value is 1 and currentnum is 3, that is, 1 of the group of clients proxied by proxyP are redirected if avg <2 and currentNum-avg >1 are satisfied.
From the foregoing, it can be seen that the number of clients that need to be changed is determined by a specific policy. In one possible implementation, the third generation server is determined to meet the balancing condition when a difference between the number of clients with group information of the third generation server agent and the number of clients with group information of the second generation server agent is less than a set threshold.
According to the scheme, when one proxy server fails, the clients with the same group of information are distributed on different proxy servers relatively uniformly no matter whether the receiving and transmitting attributes of the clients are transmitted or received, so that the influence of the proxy server failure on the service is reduced.
Based on this, the present application provides a method flow of messaging as shown in fig. 4.
As shown in fig. 4:
in step 401, the first client receives information of a third generation server sent by the first proxy server.
It should be noted that the third generation server is determined by the proxy status of the second proxy server acquired from the registry by the first proxy server; the second proxy server comprises a second client with the same group information as the first client in the clients which are currently proxied; the proxy status is used to indicate a status of the second client; the group information is determined at least according to the subsystem to which the client belongs;
in step 402, the first client sends and receives a message through the third generation server.
By the scheme, the clients with the same group of information are distributed on different proxy servers relatively uniformly, and business influence caused by the faults of the proxy servers is reduced.
Based on the same inventive concept, fig. 5 illustrates an apparatus for messaging, which may be a flow of a method for messaging, according to an embodiment of the present invention.
The messaging apparatus includes:
a determining module 501, configured to determine group information to which the first client belongs; the first client is any one of the clients; each client receives and transmits information through each proxy server; wherein, the group information is at least determined according to the subsystem to which the client belongs;
an obtaining module 502, configured to obtain a proxy status of the second proxy server from the registry; the second proxy server comprises a second client with the group information in the clients which are currently proxied; the proxy status is used to indicate a status of the second client;
And a processing module 503, configured to determine a third generation server for proxy of the first client according to the proxy status of the second proxy server.
Optionally, the determining module 501 is specifically configured to:
the first proxy server receives a proxy recommendation request sent by the first client, wherein the proxy recommendation request comprises group information for indicating the first client to belong to; the proxy recommendation request is sent by the first client before sending and receiving messages.
Optionally, the determining module 501 is specifically configured to:
and the first proxy server determines the group information of the first client from the transmitted and received messages of the first client which is currently proxied.
Optionally, the processing module 503 is specifically configured to:
and the first proxy server determines the third proxy server according to the number of second clients with the same receiving and transmitting attribute as the first clients on the second proxy server.
Optionally, the processing module 503 is further configured to: before determining a third generation server for proxy of the first client, the first proxy server determines a fourth proxy server with the same machine room identification as the first proxy server in the second proxy server and the number of third clients with the same receiving and transmitting attribute as the first client in the second client of the fourth proxy server proxy;
The first proxy server determines a proxy threshold according to the number of the fourth proxy servers and the number of the third clients;
The first proxy server determines the number of the fourth clients which are provided with the group information and have the same transceiving attribute with the first client and are of the self proxy;
and the first proxy server determines the proxy server needing to be changed for the first client and the number of the first client needing to be changed according to the proxy threshold and the number of the fourth client.
Optionally, the determining module 501 is specifically configured to:
clients belonging to the same subsystem and belonging to the same data center are determined to be the same group.
Based on the same inventive concept, fig. 6 illustrates an apparatus for messaging, which may be a flow of a method for messaging, according to an embodiment of the present invention.
A receiving module 601, configured to receive information of a third generation server sent by a first proxy server; the third generation server is determined by the proxy condition of the second proxy server acquired by the first proxy server from the registration center; the second proxy server comprises a second client with the same group information as the first client in the clients which are currently proxied; the proxy status is used to indicate a status of the second client; the group information is determined at least according to the subsystem to which the client belongs;
a processing module 602, configured to send and receive messages through the third generation server.
Optionally, the receiving module 601 is further configured to: before the first client receives information of a third proxy server sent by a first proxy server, the first client sends a proxy recommendation request to the first proxy server; the agent recommendation request includes group information indicating that the first client belongs to.
Based on the same inventive concept, an embodiment of the present invention further provides a computing device, including:
A memory for storing program instructions;
and the processor is used for calling the program instructions stored in the memory and executing the messaging method according to the obtained program.
Based on the same inventive concept, the embodiments of the present invention also provide a computer-readable nonvolatile storage medium including computer-readable instructions, which when read and executed by a computer, cause the computer to perform the above-described messaging method.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (11)

1. A method of messaging, the method comprising:
the method comprises the steps that a first proxy server in an operation stage determines group information of a first client; the first client is any one of the clients and has established a connection relationship with the first proxy server; each client receives and transmits information through each proxy server; wherein, the group information is at least determined according to the subsystem to which the client belongs;
the first proxy server acquires the proxy status of the second proxy server from the registry; the second proxy server comprises a second client with the group information in the clients which are currently proxied; the proxy status is used to indicate a status of the second client;
The first proxy server determines the number of fourth proxy servers with the same machine room identification as the first proxy server in the second proxy server and the number of third clients with the same receiving and transmitting attribute as the first client in the second client proxied by the fourth proxy server; the first proxy server determines a proxy threshold according to the number of the fourth proxy servers and the number of the third clients; the first proxy server determines the number of the fourth clients which are provided with the group information and have the same transceiving attribute with the first client and are of the self proxy; the first proxy server determines the proxy server needing to be changed of the first client and the number of the first client needing to be changed according to the proxy threshold and the number of the fourth client; and the first proxy server determines a third proxy server of the first client needing to be changed according to the proxy condition of the second proxy server.
2. The method of claim 1, wherein the first proxy server determining group information to which the first client belongs comprises:
the first proxy server receives a proxy recommendation request sent by the first client, wherein the proxy recommendation request comprises group information for indicating the first client to belong to; the agent recommendation request is sent by the first client before receiving and sending a message; or alternatively
And the first proxy server determines the group information of the first client from the transmitted and received messages of the first client which is currently proxied.
3. The method of claim 1, wherein the method further comprises:
in the establishing connection stage, the first proxy server determines group information of a first client;
the first proxy server acquires the proxy status of the second proxy server from the registry; the second proxy server comprises a second client with the group information in the clients which are currently proxied; the proxy status is used to indicate a status of the second client;
and the first proxy server determines the third proxy server according to the number of second clients with the same receiving and transmitting attribute as the first clients on the second proxy server.
4. The method of claim 1, wherein the determining the proxy server of the first client and the number of first clients that need to be changed comprises:
When avg > =2 and currentnum-avg > avg/2, redirecting avg/2 clients with the same transceiving attribute of the proxy server proxy to realize the quantity modification of the first client;
When avg <2, currentnum-avg >1, redirecting 1 client with the same receiving and transmitting attribute, which is proxied by the proxy server; wherein avg is a proxy threshold, and currentNum is the number of clients with the same transceiving attribute that are proxied by the current proxy server.
5. The method according to any of claims 1 to 4, wherein the group information is determined at least from the subsystem to which the client belongs, comprising:
clients belonging to the same subsystem and belonging to the same data center are determined to be the same group.
6. A method of messaging, the method comprising:
The method comprises the steps that a first client receives information of a third generation server sent by a first proxy server; the first client has established a connection relationship with the first proxy server and is determined by the first proxy server to be a client that needs to be changed to a third proxy server; the third generation server is determined by the proxy condition of the second proxy server acquired by the first proxy server from the registration center; the second proxy server comprises a second client with the same group information as the first client in the clients which are currently proxied; the proxy status is used to indicate a status of the second client; the group information is determined at least according to the subsystem to which the client belongs;
the first client receives and transmits messages through the third generation server;
the first proxy server determines a client needing to be changed to a third generation server by the following method:
the first proxy server determines the number of fourth proxy servers with the same machine room identification as the first proxy server in the second proxy server and the number of third clients with the same receiving and transmitting attribute as the first client in the second client proxied by the fourth proxy server;
The first proxy server determines a proxy threshold according to the number of the fourth proxy servers and the number of the third clients;
The first proxy server determines the number of the fourth clients which are provided with the group information and have the same transceiving attribute with the first client and are of the self proxy;
and the first proxy server determines the proxy server needing to be changed for the first client and the number of the first client needing to be changed according to the proxy threshold and the number of the fourth client.
7. The method of claim 6, wherein before the first client receives the information from the third proxy server sent by the first proxy server, further comprising:
The first client sends a proxy recommendation request to the first proxy server; the agent recommendation request includes group information indicating that the first client belongs to.
8. An apparatus for messaging, comprising:
The determining module is used for determining group information of the first client in the operation stage; the first client is any one of the clients and has established a connection relationship with the first proxy server; each client receives and transmits information through each proxy server; wherein, the group information is at least determined according to the subsystem to which the client belongs;
The acquisition module is used for acquiring the proxy condition of the second proxy server from the registration center; the second proxy server comprises a second client with the group information in the clients which are currently proxied; the proxy status is used to indicate a status of the second client;
The determining module is further configured to determine a fourth proxy server in the second proxy server, where the fourth proxy server is identical to a machine room identifier of the first proxy server, and the number of third clients in the second client proxied by the fourth proxy server, where the third clients have identical receiving and transmitting properties with the first client; the first proxy server determines a proxy threshold according to the number of the fourth proxy servers and the number of the third clients; the first proxy server determines the number of the fourth clients which are provided with the group information and have the same transceiving attribute with the first client and are of the self proxy; the first proxy server determines the proxy server needing to be changed of the first client and the number of the first client needing to be changed according to the proxy threshold and the number of the fourth client; and the processing module is used for determining a third generation server of the first client which needs to be changed by the proxy according to the proxy condition of the second proxy server.
9. An apparatus for messaging, applied to a first client, comprising:
The receiving module is used for receiving the information of the third generation server sent by the first proxy server; the first client has established a connection relationship with the first proxy server and is determined by the first proxy server to be a client that needs to be changed to a third proxy server; the third generation server is determined by the proxy condition of the second proxy server acquired by the first proxy server from the registration center; the second proxy server comprises a second client with the same group information as the first client in the clients which are currently proxied; the proxy status is used to indicate a status of the second client; the group information is determined at least according to the subsystem to which the client belongs;
the processing module is used for receiving and sending messages through the third generation server;
the first proxy server determines a client needing to be changed to a third generation server by the following method:
the first proxy server determines the number of fourth proxy servers with the same machine room identification as the first proxy server in the second proxy server and the number of third clients with the same receiving and transmitting attribute as the first client in the second client proxied by the fourth proxy server;
The first proxy server determines a proxy threshold according to the number of the fourth proxy servers and the number of the third clients;
The first proxy server determines the number of the fourth clients which are provided with the group information and have the same transceiving attribute with the first client and are of the self proxy;
and the first proxy server determines the proxy server needing to be changed for the first client and the number of the first client needing to be changed according to the proxy threshold and the number of the fourth client.
10. A computing device, comprising:
A memory for storing program instructions;
a processor for invoking program instructions stored in said memory to perform the method of any of claims 1 to 5 or 6 to 7 in accordance with the obtained program.
11. A computer readable non-transitory storage medium comprising computer readable instructions which, when read and executed by a computer, cause the computer to perform the method of any of claims 1 to 5 or 6 to 7.
CN202010396848.6A 2020-05-12 2020-05-12 Message receiving and transmitting method and device Active CN111654527B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010396848.6A CN111654527B (en) 2020-05-12 2020-05-12 Message receiving and transmitting method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010396848.6A CN111654527B (en) 2020-05-12 2020-05-12 Message receiving and transmitting method and device

Publications (2)

Publication Number Publication Date
CN111654527A CN111654527A (en) 2020-09-11
CN111654527B true CN111654527B (en) 2024-06-28

Family

ID=72347875

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010396848.6A Active CN111654527B (en) 2020-05-12 2020-05-12 Message receiving and transmitting method and device

Country Status (1)

Country Link
CN (1) CN111654527B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103259809A (en) * 2012-02-15 2013-08-21 株式会社日立制作所 Load balancer, load balancing method and stratified data center system

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20110035550A (en) * 2009-09-30 2011-04-06 한국정보통신주식회사 Electronic commerce system and method for providing a purchase loan service and server apparatus thereof
CN106203971A (en) * 2015-04-30 2016-12-07 深圳市银信网银科技有限公司 Payment system based on same fund server and method of payment, device and server
US10333846B2 (en) * 2016-02-19 2019-06-25 Citrix Systems, Inc. Systems and methods for routing network packets between multi-core intermediaries
US10237187B2 (en) * 2016-04-29 2019-03-19 Citrix Systems, Inc. System and method for service chain load balancing
CN107196869B (en) * 2017-07-14 2019-11-15 北京知道创宇信息技术股份有限公司 The adaptive load balancing method, apparatus and system of Intrusion Detection based on host actual loading
CN110175074A (en) * 2019-04-18 2019-08-27 北京奇艺世纪科技有限公司 Load-balancing method and server, load unit, service processing apparatus and medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103259809A (en) * 2012-02-15 2013-08-21 株式会社日立制作所 Load balancer, load balancing method and stratified data center system

Also Published As

Publication number Publication date
CN111654527A (en) 2020-09-11

Similar Documents

Publication Publication Date Title
US11411897B2 (en) Communication method and communication apparatus for message queue telemetry transport
CN109885410B (en) Message sending method, device, computer equipment and storage medium
US8838703B2 (en) Method and system for message processing
US8095935B2 (en) Adapting message delivery assignments with hashing and mapping techniques
CN110011930B (en) Load balancing method and device for multi-union chain in block chain
CN108062243B (en) Execution plan generation method, task execution method and device
CN109951537B (en) Load balancing distribution method facing block chain
CN112866421B (en) Intelligent contract operation method and device based on distributed cache and NSQ
CN101753597B (en) Keeping alive method between peer node and client under peer node-client architecture
CN112953982B (en) Service processing method, service configuration method and related device
CN111698167A (en) Message processing method and device
CN110798329A (en) Internet of things gateway access method, equipment and storage medium
US20120036185A1 (en) State management in a distributed computing system
CN111083204A (en) File transmission method, device and storage medium
CN112491951B (en) Request processing method, server and storage medium in peer-to-peer network
CN111654527B (en) Message receiving and transmitting method and device
US10904327B2 (en) Method, electronic device and computer program product for searching for node
CN104253702A (en) Terminal management method and system
CN115952003A (en) Method, device, equipment and storage medium for cluster server load balancing
CN113596105B (en) Content acquisition method, edge node and computer readable storage medium
CN109688204B (en) File downloading method, node and terminal based on NDN (named data networking)
CN108093147B (en) Distributed multi-stage scheduling method and equipment
CN110995890A (en) Domain name request scheduling method and device
CN111464579A (en) Message processing method and server
CN111770167B (en) Service gateway of load balancing algorithm based on processing capacity of server side

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