CN109600452B - Server cluster, message pushing method and related server - Google Patents

Server cluster, message pushing method and related server Download PDF

Info

Publication number
CN109600452B
CN109600452B CN201811634939.8A CN201811634939A CN109600452B CN 109600452 B CN109600452 B CN 109600452B CN 201811634939 A CN201811634939 A CN 201811634939A CN 109600452 B CN109600452 B CN 109600452B
Authority
CN
China
Prior art keywords
server
terminal
execution server
execution
message
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
CN201811634939.8A
Other languages
Chinese (zh)
Other versions
CN109600452A (en
Inventor
马东辉
李宁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Rockwell Technology Co Ltd
Original Assignee
Beijing CHJ Automotive Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing CHJ Automotive Information Technology Co Ltd filed Critical Beijing CHJ Automotive Information Technology Co Ltd
Priority to CN201811634939.8A priority Critical patent/CN109600452B/en
Publication of CN109600452A publication Critical patent/CN109600452A/en
Application granted granted Critical
Publication of CN109600452B publication Critical patent/CN109600452B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/55Push-based network services
    • 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/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Abstract

The invention provides a server cluster, a message pushing method and a related server, wherein if a proxy server of the server cluster receives a message pushing request sent by a first terminal, a first instruction is sent to a second execution server; the second execution server searches the connection information of the second terminal in the shared storage system; the proxy server receives the connection information of the second terminal sent by the second execution server and sends a second instruction to the first execution server; the first execution server is used for sending a third instruction to a third execution server according to the second instruction; the third execution server is used for pushing the webpage port message corresponding to the third indication to the second terminal. Therefore, the scheme of pushing messages across the servers in the server cluster can be realized. The server developed based on non-blocking input/output is adopted, the problem of expansibility when the webpage ports are connected is solved, occupied resources are smaller, performance is better, data connection amount is larger, and the connection scheme of the server cluster is optimized.

Description

Server cluster, message pushing method and related server
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a server cluster, a message push method, and a related server.
Background
With the development of communication technology, information transfer schemes are also gradually optimized. And pushing a message to the client, wherein communication connection between the server and the client needs to be established based on a certain communication protocol. A Web port (Web Socket) Protocol has been widely used as a substitute for a Hyper Text Transfer Protocol (HTTP Protocol) Protocol because of its advantages such as bidirectional communication. The server cluster is used for realizing the connection among a plurality of servers through a shared storage system, generally sharing information of a shared storage database, however, each server can only store the connection of a webpage port in a memory of the server cluster, and webpage port conversation cannot be serialized and is stored in the database of the server cluster.
Therefore, in a server cluster, cross-server netpage port push cannot be implemented.
Disclosure of Invention
The embodiment of the invention provides a server cluster, a message pushing method and a related server, and aims to solve the technical problem that cross-server webpage port pushing cannot be realized in the conventional server cluster.
In order to achieve the purpose, the invention provides the following specific scheme:
in a first aspect, an embodiment of the present invention provides a server cluster, where the server cluster includes a proxy server and at least three execution servers;
the proxy server is used for sending a first indication to a second execution server if receiving a message pushing request sent by a first terminal under the condition that a first execution server establishes a webpage port connection with the first terminal, wherein the message pushing request comprises identity information of the second terminal, and the second terminal is a terminal requested to be pushed by the message pushing request;
the second execution server is configured to search, according to the first indication, connection information of the second terminal in a shared storage system of the server cluster, where the connection information includes identity information of a third execution server, and the third execution server is an execution server that establishes a web port connection with the second terminal in the server cluster;
the proxy server is configured to receive connection information of the second terminal sent by the second execution server, and send a second indication to the first execution server, where the second indication includes identity information of the third execution server;
the first execution server is configured to send a third indication to the third execution server according to the second indication, where the third indication includes identity information of the second terminal;
the third execution server is used for pushing the webpage port message corresponding to the third indication to the second terminal under the condition that the webpage port connection is established with the second terminal;
wherein the first execution server and the third execution server are both developed based on non-blocking input/output.
Optionally, the second execution server is a development server based on blocking input/output according to a hypertext transfer protocol.
In a second aspect, an embodiment of the present invention provides a message pushing method, which is applied to a proxy server, where the proxy server is a proxy server in a server cluster according to any one of the first aspect, and the method includes:
under the condition that a first terminal establishes a webpage port connection with a first execution server, if a message pushing request sent by the first terminal is received, sending a first indication to a second execution server so that the second execution server searches connection information of a second terminal in a shared storage system of a server cluster according to the first indication, wherein the second terminal is a terminal requested to be pushed by the message pushing request, and the message pushing request comprises identity information of the second terminal;
receiving connection information of the second terminal sent by the second execution server, wherein the connection information includes identity information of a third execution server, and the third execution server is an execution server establishing a web port connection with the second terminal in the server cluster;
and sending a second indication to the first execution server to enable the first execution server to notify the third execution server to push the webpage port message corresponding to the message pushing request to the second terminal, wherein the second indication includes identity information of the third execution server.
In a third aspect, an embodiment of the present invention further provides another message pushing method, which is applied to a first execution server, where the first execution server is a first execution server in a server cluster according to any of the first aspect, and the method includes:
receiving a message pushing request sent by a first terminal under the condition that the first execution server establishes webpage port connection with the first terminal, wherein the message pushing request comprises identity information of a second terminal requesting pushing;
if a second instruction sent by a proxy server is received, sending a third instruction to a third execution server so that the third execution server pushes a webpage port message corresponding to the message pushing request to the second terminal, wherein the third execution server is an execution server which establishes a webpage port connection with the second terminal in the server cluster, and the second instruction comprises identity information of the third execution server;
wherein the first execution server is a server developed based on non-blocking input/output.
Optionally, the message pushing request includes a target message requesting pushing;
the step of sending a third instruction to the third execution server to enable the third execution server to push the web port message corresponding to the message push request to the second terminal includes:
sending a uniform resource locator request including the target message to the third execution server.
In a fourth aspect, an embodiment of the present invention further provides a message pushing method, which is applied to a third execution server, where the third execution server is a third execution server in a server cluster according to any one of the first aspects, and the method includes:
under the condition of establishing webpage port connection with a second terminal, if a third instruction sent by the first execution server is received, pushing a webpage port message corresponding to the third instruction to the second terminal, wherein the third instruction comprises identity information of the second terminal;
wherein the third execution server is a server developed based on non-blocking input/output.
Optionally, before the step of pushing the web port message corresponding to the third indication to the second terminal, the method further includes:
and when web page port connection is established with the second terminal, adding the connection information of the second terminal into the shared storage system of the server cluster, wherein the connection information of the second terminal comprises the identity information of the third execution server.
Optionally, after the step of adding the connection information of the second terminal to the shared storage system of the server cluster, the method further includes:
and when the webpage port connection with the second terminal is disconnected, deleting the connection information of the second terminal from the shared storage system.
In a fifth aspect, an embodiment of the present invention provides a proxy server, including:
a first sending module, configured to send a first indication to a second execution server if a message push request sent by a first terminal is received when the first terminal establishes a web port connection with the first execution server, so that the second execution server searches for connection information of a second terminal in a shared storage system of the server cluster according to the first indication, where the second terminal is a terminal requested to be pushed by the message push request, and the message push request includes identity information of the second terminal;
a receiving module, configured to receive connection information of the second terminal sent by the second execution server, where the connection information includes identity information of a third execution server, and the third execution server is an execution server that establishes a web port connection with the second terminal in the server cluster;
a second sending module, configured to send a second indication to the first execution server, so that the first execution server notifies the third execution server to push a web port message corresponding to the message push request to the second terminal, where the second indication includes identity information of the third execution server.
In a sixth aspect, an embodiment of the present invention provides a first execution server, including:
the receiving module is used for receiving a message pushing request sent by a first terminal under the condition that the first execution server establishes a webpage port connection with the first terminal, wherein the message pushing request comprises identity information of a second terminal requesting pushing;
a sending module, configured to send a third instruction to a third execution server if a second instruction sent by a proxy server is received, so that the third execution server pushes a web port message corresponding to the message pushing request to the second terminal, where the third execution server is an execution server that establishes a web port connection with the second terminal in the server cluster, and the second instruction includes identity information of the third execution server;
wherein the first execution server is a server developed based on non-blocking input/output.
Optionally, the message pushing request includes a target message requesting pushing;
the sending module is used for:
sending a uniform resource locator request including the target message to the third execution server.
In a seventh aspect, an embodiment of the present invention provides a third execution server, including:
the push module is used for pushing a webpage port message corresponding to a third instruction to a second terminal if the third instruction sent by the first execution server is received under the condition that the webpage port connection is established with the second terminal, wherein the third instruction comprises identity information of the second terminal;
wherein the third execution server is a server developed based on non-blocking input/output.
Optionally, the third execution server further includes:
and the adding module is used for adding the connection information of the second terminal into the shared storage system of the server cluster when establishing the webpage port connection with the second terminal, wherein the connection information of the second terminal comprises the identity information of the third execution server.
Optionally, the third execution server further includes:
and the deleting module is used for deleting the connection information of the second terminal from the shared storage system when the webpage port connection with the second terminal is disconnected.
In an eighth aspect, an embodiment of the present invention provides a server, including a transceiver, a bus interface, a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the message pushing method according to any one of the second to fourth aspects when executing the computer program.
In a ninth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the message pushing method according to any one of the first to third aspects.
According to the server cluster and the message pushing method provided by the embodiment of the invention, after the first terminal establishes the connection of the webpage port with the first execution server in the server cluster, the message pushing request can be sent to the server cluster. The proxy server indicates the second execution server to inquire the second terminal requested to be pushed by the message pushing request, the identity information of a third execution server connected with the second terminal is in the server cluster, and then the first execution server informs the third execution server of pushing the message to the second terminal. In this way, a scheme of pushing messages across servers in a server cluster can be realized. In addition, the first execution server and the second execution server are both developed based on non-blocking input/output, the problem of expansibility when the webpage ports are connected is solved, occupied resources are smaller, performance is better, data connection amount is larger, and a connection scheme of a server cluster is optimized.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive exercise.
Fig. 1 is an interaction schematic diagram of a server cluster according to an embodiment of the present invention; (ii) a
Fig. 2 is a schematic flow chart of a message pushing method according to an embodiment of the present invention
Fig. 3 is a schematic flowchart of another message pushing method according to an embodiment of the present invention;
fig. 4 is a flowchart illustrating another message pushing method according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a proxy server according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a first execution server according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a third execution server according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of another third execution server according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of another server according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. 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 invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a server cluster according to an embodiment of the present invention. As shown in fig. 1, the server cluster includes a proxy server and at least three execution servers.
In this embodiment, the proxy server, serving as a load balancing device of the server cluster, may receive a plurality of requests sent by the external terminal to the server cluster, distribute the received requests to the corresponding execution servers according to the content of the requests, and execute the terminal requests by the corresponding execution servers.
At least two execution servers in the server cluster are mainly divided into two types, namely execution servers used for executing requests of external terminals and execution servers used for executing work in the cluster such as inquiry and storage distributed by the proxy server. In this embodiment, the server cluster includes a first execution server, a second execution server, and a third execution server, where the first execution server and the third execution server are configured to execute the request to the external terminal, and the second execution server is configured to execute the intra-cluster work allocated by the proxy server.
Optionally, the proxy server may be a Nginx, and the proxy server may be configured to proxy an HTTP request and a Web Socket request between the terminal and the server.
Optionally, the first execution server and the third execution server may be servers developed based on non-blocking input/output, such as a Netty server. The Netty server occupies smaller resources, has better performance, can easily realize a connection scheme of millions of terminals, and effectively avoids the problem of expansibility in a server cluster environment.
Alternatively, the second execution server may be a blocking input/output based development server according to the hypertext transfer protocol, such as a Tomcat service. The Tomcat server has low development cost and relatively excellent performance, and can be used as a second execution server.
Of course, the second execution server may also be a Netty server, so as to achieve a better request processing effect.
In addition, the server cluster also has a shared storage system for storing the common information of the server cluster, and a plurality of servers in the server cluster can inquire, store, update and modify the common information in the shared storage system. The shared storage system can be a Redis system, and the Redis system has the advantages of excellent read-write performance, support of data persistence, rich data structure and the like.
The proxy server is used for sending a first indication to a second execution server if receiving a message pushing request sent by a first terminal under the condition that a first execution server establishes a webpage port connection with the first terminal, wherein the message pushing request comprises identity information of the second terminal, and the second terminal is a terminal requested to be pushed by the message pushing request;
the second execution server is configured to search, according to the first indication, connection information of the second terminal in a shared storage system of the server cluster, where the connection information includes identity information of a third execution server, and the third execution server is an execution server that establishes a web port connection with the second terminal in the server cluster;
the proxy server is configured to receive connection information of the second terminal sent by the second execution server, and send a second indication to the first execution server, where the second indication includes identity information of the third execution server;
the first execution server is configured to send a third indication to the third execution server according to the second indication, where the third indication includes identity information of the second terminal;
the third execution server is used for pushing the webpage port message corresponding to the third indication to the second terminal under the condition that the webpage port connection is established with the second terminal;
wherein the first execution server and the third execution server are both developed based on non-blocking input/output.
In the server cluster provided in this embodiment, after the first terminal establishes the web port connection with the first execution server in the server cluster, a message push request may be sent to the server cluster. The proxy server indicates the second execution server to inquire the second terminal requested to be pushed by the message pushing request, the identity information of a third execution server connected with the second terminal is in the server cluster, and then the first execution server informs the third execution server of pushing the message to the second terminal. In this way, a scheme of pushing messages across servers in a server cluster can be realized. In addition, the first execution server and the second execution server are both developed based on non-blocking input/output, the problem of expansibility when the webpage ports are connected is solved, occupied resources are smaller, performance is better, data connection amount is larger, and a connection scheme of a server cluster is optimized.
Referring to fig. 2, a schematic flow chart of a message pushing method according to an embodiment of the present invention is provided, where the message pushing method is applied to a proxy server in a server cluster. As shown in fig. 2, the message pushing method provided in this embodiment mainly includes the following steps:
step 201, under the condition that a first terminal establishes a web port connection with a first execution server, if a message push request sent by the first terminal is received, sending a first indication to a second execution server, so that the second execution server searches for connection information of the second terminal in a shared storage system of a server cluster according to the first indication;
the first execution server establishes a Web port connection, namely a Web Socket connection, with the first terminal, and the first execution server can push a Web Socket message to the first terminal. In this embodiment, the first terminal may be a terminal capable of bearing a browser, including but not limited to a mobile phone, a tablet, a vehicle-mounted computer, and a computer.
In addition, the first terminal may also send a message push request to the server cluster to request the server cluster to push a Web Socket message to other terminals except the first terminal, which requires that the other terminals and an execution server in the server cluster also establish a Web Socket connection. The terminal requested to be pushed by the message pushing request is defined as the second terminal, and the message pushing request sent by the first terminal also includes the identity information of the second terminal. Optionally, the identity information of the terminal may be stored in the form of a Cookie (data stored on the local terminal of the user), or the terminal user may manually edit an input number or account as the identity information of the terminal.
In addition, the message pushing request may also include the type or specific content of the Web Socket message requested to be pushed, so that the server cluster can accurately correspond to the requested Web Socket message to the second terminal, and the requirement for diversity of the Web Socket message requested to be pushed is met.
After the first terminal sends the message pushing request to the server cluster, the proxy server instructs a second execution server in the server cluster to inquire the connection information of the second terminal according to the content of the message pushing request, wherein the connection information of the second terminal is the connection state of the second terminal and a relevant server in the server cluster.
In addition, after establishing the Web Socket connection with the terminal, the execution server stores the connection information of the terminal in the shared storage system. For example, when the second terminal establishes a Web Socket connection with a third server in the server cluster, the third execution server stores the connection information of the second terminal in the shared storage system. Specifically, the third execution server may store the identity information of the third terminal as a key and the identity information of the third execution server as a Value in the shared storage system. If the third execution server and the second terminal are disconnected from the Web Socket, the third execution server can delete the connection information of the second terminal from the shared storage system. The identity information of the server may include an internet protocol IP address and a port number of the server, or identity information formed in the form of a number, an IP address, or a Sequence number (SEQ).
Step 202, receiving the connection information of the second terminal sent by the second execution server;
and the second execution server searches the connection information of the second terminal in the shared storage system according to the first instruction of the proxy server. If the second execution server finds the connection information of the second terminal and the connection information of the second terminal includes the identity information of the third execution server, it indicates that the second terminal and the third execution server establish a Web Socket connection under the current condition, so that the third execution server can push a Web Socket message to the second terminal.
If the second execution server does not find the connection information of the second terminal, it indicates that the second terminal does not establish a Web Socket connection with the server in the server cluster, or the connection is disconnected, and the Web Socket message cannot be pushed to the second terminal. At this time, the server cluster may directly end the message pushing operation, and may also return a connection indication that the Web Socket cannot be pushed to the second terminal to the first terminal.
Step 203, sending a second instruction to the first execution server, so that the first execution server notifies a third execution server to push a web port message corresponding to the message push request to the second terminal.
And after determining that the second terminal establishes a Web Socket connection with the third execution server, the proxy server sends a second instruction to the first execution server, wherein the second instruction may include identity information of the third execution server. And after receiving the second instruction, the first execution server informs a third execution server of pushing a Web Socket message to the second terminal.
Specifically, the first execution server may send only a push notification including the identity information of the second terminal to the third execution server, so that the third execution server pushes the agreed Web Socket message to the second terminal. The push notification sent by the first execution server may also include a message type requesting for pushing, so that the third execution server obtains the Web Socket message corresponding to the message type and pushes the Web Socket message to the third terminal. Of course, the push notification sent by the first executor may also directly include a Web Socket message requesting for push, so that the third execution server forwards the received Web Socket message to the second terminal. Thus, the message pushing operation is completed.
Of course, in another embodiment, after the second execution server obtains the connection information of the second terminal, the second execution server may directly send the connection information of the second terminal to the first execution server, so that the first execution server notifies the third execution server of pushing the Web Socket message, which is not limited.
It should be noted that, in this embodiment, the first execution server and the third server may be different servers or may be the same server. If the first execution server and the third execution server are the same server, the first terminal and the second terminal establish a Web Socket connection with the first execution server. In this case, the first execution server directly pushes the Web Socket message to the second terminal after receiving the second instruction from the proxy server.
In the message pushing method provided in the embodiment of the present invention, the proxy server instructs, according to the message pushing request sent by the first terminal, the second execution server to query the second terminal requested to be pushed by the message pushing request in the server cluster, and the identity information of the third execution server connected to the second terminal, and then notifies the third execution server to push the message to the second terminal through the first execution server. In this way, a scheme of pushing messages across servers in a server cluster can be realized. In addition, the first execution server and the second execution server are both developed based on non-blocking input/output, the problem of expansibility when the webpage ports are connected is solved, occupied resources are smaller, performance is better, data connection amount is larger, and a connection scheme of a server cluster is optimized.
Referring to fig. 3, a flowchart of a message pushing method according to another embodiment of the present invention is shown, where the message pushing method is applied to a first execution server in a server cluster. As shown in fig. 3, the provided message pushing method mainly includes:
step 301, receiving a message pushing request sent by a first terminal under the condition of establishing a web port connection with the first terminal;
step 302, if a second instruction sent by the proxy server is received, a third instruction is sent to a third execution server, so that the third execution server pushes the web port message corresponding to the message pushing request to the second terminal.
In this embodiment, the first execution server establishes a Web Socket connection with the first terminal, and the first execution server may receive a message push request sent by the first terminal. And after receiving the message pushing request, the proxy server in the server cluster analyzes the second terminal requested to be pushed by the message pushing request. The proxy server acquires the identity information of the second terminal contained in the message pushing request, and generates a first indication containing the identity information of the second terminal to indicate the second execution server to inquire the connection information of the second terminal in the shared storage system of the server cluster.
And if the second execution server finds a third execution server of which the second terminal establishes Web Socket connection in the server cluster in the shared storage system, the second execution server returns the identity information of the third execution server to the proxy server, and the proxy server sends the identity information containing the third execution server to the first execution server.
And after receiving the second instruction sent by the proxy server, the first execution server informs the third execution server of pushing the Web Socket message to the second terminal. In particular, the first execution server may send a third indication to the third execution server, where the third indication may include the identity information of the second terminal. And after receiving the third instruction, the third server pushes the Web Socket message to the second terminal.
Optionally, the message push request may further include a target message requesting to be pushed;
the step of sending a third instruction to the third execution server so that the third execution server pushes the web port message corresponding to the message push request to the second terminal in step 302 may include:
sending a uniform resource locator request including the target message to the third execution server.
The first execution server sends a Uniform Resource Locator (URL) request to the third execution server, where the URL request includes a target message requesting push. And after receiving the URL request, the third execution server pushes the target message to the second terminal.
In the message pushing method provided by the embodiment of the invention, after the first terminal establishes the web port connection with the first execution server in the server cluster, the message pushing request can be sent to the server cluster. The proxy server indicates the second execution server to inquire the second terminal requested to be pushed by the message pushing request, the identity information of a third execution server connected with the second terminal is in the server cluster, and then the first execution server informs the third execution server of pushing the message to the second terminal. In this way, a scheme of pushing messages across servers in a server cluster can be realized. In addition, the first execution server and the second execution server are both developed based on non-blocking input/output, the problem of expansibility when the webpage ports are connected is solved, occupied resources are smaller, performance is better, data connection amount is larger, and a connection scheme of a server cluster is optimized. For a specific implementation process of the message pushing method provided in the embodiment of the present invention, reference may be made to the specific implementation process of the message pushing method provided in the embodiment shown in fig. 1, which is not described in detail herein.
Referring to fig. 4, a schematic flow chart of a message pushing method according to another embodiment of the present invention is shown, where the message pushing method according to this embodiment is applied to a third execution server in a server cluster. As shown in fig. 4, the provided message pushing method mainly includes:
step 401, under the condition of establishing a web port connection with a second terminal, if a third instruction sent by a first execution server is received, pushing a web port message corresponding to the third instruction to the second terminal.
In this embodiment, a third execution server in the server cluster establishes a Web Socket connection with the second terminal, and the third execution server may push a Web Socket message to the second terminal. In addition, a first execution server in the server cluster establishes a Web Socket connection with the first terminal, so that the first terminal can send a message pushing request to the first execution server to request the server cluster to push a Web Socket message to the second terminal.
After receiving the message pushing request of the first terminal, the proxy server in the server cluster acquires the identity information of the second terminal requested to be pushed by the message pushing request. And the proxy server sends a first instruction to a second execution server, and the second execution server is instructed to search the connection information of the second terminal in the shared storage system of the server cluster. And if the proxy server knows that the second terminal establishes Web Socket connection with a third execution server in the server cluster, the proxy server sends a second instruction to the first execution server to instruct the first execution server to notify the third execution server of pushing messages. And after receiving the second instruction, the first execution server sends a third instruction to a third execution server, where the third instruction may include identity information of the second terminal. And the third execution server pushes the Web Socket message to the second terminal according to the third instruction.
Optionally, before the step of pushing the web port message corresponding to the third indication to the second terminal in step 401, the method may further include:
and when establishing webpage port connection with the second terminal, adding the connection information of the second terminal into the shared storage system of the server cluster, wherein the connection information of the second terminal comprises the identity information of the second terminal.
When the third execution server establishes Web Socket connection with the second terminal, the connection information of the second terminal is stored in the shared storage system of the server cluster to record the connection state of the second terminal in the server cluster.
Correspondingly, after the step of adding the connection information of the second terminal to the shared storage system of the server cluster, the method further includes:
and when the webpage port connection with the second terminal is disconnected, deleting the connection information of the second terminal from the shared storage system.
And if the third execution server is disconnected with the second terminal by the Web Socket, deleting the connection information of the second terminal from the server cluster so as to update the connection state of the second terminal in the server cluster in real time.
Of course, in other embodiments, when monitoring that the third execution server establishes or disconnects the Web Socket connection with the second terminal, the proxy server may also instruct the second execution server or another execution server to store or delete the connection information of the second terminal, which is not limited.
In the message pushing method provided by the embodiment of the invention, after the first terminal establishes the web port connection with the first execution server in the server cluster, the message pushing request can be sent to the server cluster. The proxy server indicates the second execution server to inquire the second terminal requested to be pushed by the message pushing request, the identity information of a third execution server connected with the second terminal is in the server cluster, and then the first execution server informs the third execution server of pushing the message to the second terminal. In this way, a scheme of pushing messages across servers in a server cluster can be realized. In addition, the first execution server and the second execution server are both developed based on non-blocking input/output, the problem of expansibility when the webpage ports are connected is solved, occupied resources are smaller, performance is better, data connection amount is larger, and a connection scheme of a server cluster is optimized. For a specific implementation process of the message pushing method provided in the embodiment of the present invention, reference may be made to the specific implementation process of the message pushing method provided in the embodiment shown in fig. 1, which is not described in detail herein.
Fig. 5 is a schematic structural diagram of a proxy server according to an embodiment of the present invention. The proxy server may be the proxy server in the embodiments shown in fig. 1 to 4. As shown in fig. 5, the proxy server 500 includes:
a first sending module 501, configured to send a first indication to a second execution server if a message push request sent by a first terminal is received when the first terminal establishes a web port connection with a first execution server, so that the second execution server searches for connection information of a second terminal in a shared storage system of a server cluster according to the first indication, where the second terminal is a terminal requested to be pushed by the message push request, and the message push request includes identity information of the second terminal;
a receiving module 502, configured to receive connection information of the second terminal sent by the second execution server, where the connection information includes identity information of a third execution server, and the third execution server is an execution server that establishes a web port connection with the second terminal in the server cluster;
a second sending module 503, configured to send a second indication to the first execution server, so that the first execution server notifies the third execution server to push the web port message corresponding to the message push request to the second terminal, where the second indication includes identity information of the third execution server.
The proxy server provided in the embodiment of the present invention, according to the message push request sent by the first terminal, instructs the second execution server to query the second terminal requested to be pushed by the message push request in the server cluster, and notifies the third execution server of pushing the message to the second terminal through the first execution server. In this way, a scheme of pushing messages across servers in a server cluster can be realized. In addition, the first execution server and the second execution server are both developed based on non-blocking input/output, the problem of expansibility when the webpage ports are connected is solved, occupied resources are smaller, performance is better, data connection amount is larger, and a connection scheme of a server cluster is optimized. The specific implementation process of the proxy server provided in the embodiment of the present invention may refer to the specific implementation process of the server cluster and the message pushing method provided in any one of the embodiments shown in fig. 1 to fig. 4, and is not described in detail here.
Fig. 6 is a schematic structural diagram of a first execution server according to an embodiment of the present invention. The first execution server may be the first execution server in the embodiments shown in fig. 1 to 4. As shown in fig. 6, the first execution server 600 may include:
a receiving module 601, configured to receive a message pushing request sent by a first terminal when the first execution server establishes a web port connection with the first terminal, where the message pushing request includes identity information of a second terminal requesting pushing;
a sending module 602, configured to send a third instruction to the third execution server if a second instruction sent by the proxy server is received, so that the third execution server pushes, to the second terminal, a web port message corresponding to the message pushing request, where the third execution server is an execution server that establishes a web port connection with the second terminal in the server cluster, and the second instruction includes identity information of the third execution server;
wherein the first execution server is a server developed based on non-blocking input/output.
Optionally, the message pushing request includes a target message requesting pushing;
the sending module 602 is configured to:
sending a uniform resource locator request including the target message to the third execution server.
In the first execution server provided in the embodiment of the present invention, the proxy server instructs, according to the message push request sent by the first terminal, the second execution server to query the second terminal requested to be pushed by the message push request in the server cluster, and the identity information of the third execution server connected to the second terminal, and then notifies, through the first execution server, the third execution server of pushing the message to the second terminal. In this way, a scheme of pushing messages across servers in a server cluster can be realized. In addition, the first execution server and the second execution server are both developed based on non-blocking input/output, the problem of expansibility when the webpage ports are connected is solved, occupied resources are smaller, performance is better, data connection amount is larger, and a connection scheme of a server cluster is optimized. The specific implementation process of the first execution server provided in the embodiment of the present invention may refer to the specific implementation process of the server cluster and the message pushing method provided in any one of the embodiments shown in fig. 1 to fig. 4, and details are not described here any more.
Fig. 7 is a schematic structural diagram of a third execution server according to an embodiment of the present invention. The third execution server may be the third execution server in the embodiments shown in fig. 1 to 4. As shown in fig. 7, the third execution server 700 may include:
a pushing module 701, configured to, when a web port connection is established between the third execution server and the second terminal, if a third instruction sent by the first execution server is received, push a web port message corresponding to the third instruction to the second terminal, where the third instruction includes identity information of the second terminal;
wherein the third execution servers are all servers developed based on non-blocking input/output.
Optionally, as shown in fig. 8, the third execution server 700 may further include:
an adding module 701, configured to add connection information of the second terminal to a shared storage system of the server cluster when establishing a web port connection with the second terminal, where the connection information of the second terminal includes identity information of the second terminal.
Optionally, as shown in fig. 8, the third execution server 700 may further include:
a deleting module 702, configured to delete the connection information of the second terminal from the shared storage system when the web port connection is disconnected with the second terminal.
In the third execution server provided in the embodiment of the present invention, the proxy server instructs, according to the message push request sent by the first terminal, the second execution server to query the server cluster for the identity information of the third execution server connected to the second terminal requested to be pushed by the message push request, and then notifies, by the first execution server, the third execution server of pushing a message to the second terminal. In this way, a scheme of pushing messages across servers in a server cluster can be realized. In addition, the first execution server and the second execution server are both developed based on non-blocking input/output, the problem of expansibility when the webpage ports are connected is solved, occupied resources are smaller, performance is better, data connection amount is larger, and a connection scheme of a server cluster is optimized. For a specific implementation process of the third execution server provided in the embodiment of the present invention, reference may be made to a specific implementation process of the server cluster and the message pushing method provided in any one of the embodiments shown in fig. 1 to fig. 4, which is not described in detail here.
Fig. 9 is a schematic structural diagram of a server according to an embodiment of the present invention. As shown in fig. 9, the server 900 includes: a transceiver 901, a bus interface, and a processor 902. Where the server 900 is a different server in a cluster of servers, the transceiver and processor perform different functions.
If the server 900 is a proxy server;
the transceiver 901 may be configured to, when a first terminal establishes a web port connection with a first execution server, send a first indication to a second execution server if a message push request sent by the first terminal is received, so that the second execution server searches for connection information of a second terminal in a shared storage system of a server cluster according to the first indication, where the second terminal is a terminal requested to be pushed by the message push request, and the message push request includes identity information of the second terminal;
receiving connection information of the second terminal sent by the second execution server, wherein the connection information includes identity information of a third execution server, and the third execution server is an execution server establishing a web port connection with the second terminal in the server cluster;
a processor 902 operable to generate a second indication;
the transceiver 901 is further configured to send a second indication to the first execution server, so that the first execution server notifies the third execution server to push a web port message corresponding to the message push request to the second terminal, where the second indication includes identity information of the third execution server.
If the server 900 is a first execution server;
a transceiver 901, configured to receive a message push request sent by a first terminal when the first execution server establishes a web port connection with the first terminal, where the message push request includes identity information of a second terminal requesting to push;
a processor 902, configured to generate a third indication if the second indication sent by the proxy server is received;
the transceiver 901 may further be configured to send a third indication to the third execution server, so that the third execution server pushes the web port message corresponding to the message pushing request to the second terminal, where the third execution server is an execution server that establishes a web port connection with the second terminal in the server cluster, and the second indication includes identity information of the third execution server;
wherein the first execution server is a server developed based on non-blocking input/output.
Optionally, the message pushing request includes a target message requesting pushing;
the processor 902 the transceiver 901 may further be configured to:
sending a uniform resource locator request including the target message to the third execution server.
If the server 900 is a third execution server;
the transceiver 901 may be configured to, when the third execution server establishes a web port connection with a second terminal, if a third instruction sent by the first execution server is received, push a web port message corresponding to the third instruction to the second terminal, where the third instruction includes identity information of the second terminal;
wherein the third execution servers are all servers developed based on non-blocking input/output.
As shown in fig. 9, in the embodiment of the present invention, the server 900 further includes: and a memory 903. In fig. 9, the bus architecture may include any number of interconnected buses and bridges, with various circuits being linked together, particularly one or more processors represented by processor 902 and memory represented by memory 903. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. The bus interface provides an interface. The transceiver 901 may be a number of elements including a transmitter and a receiver providing a means by which communications may be made with various other apparatus over a transmission medium. The processor 902 is responsible for managing the bus architecture and general processing, and the memory 903 may store data used by the processor 902 in performing operations.
The server provided by the embodiment of the present invention can implement the functions of the server cluster and the message pushing method provided by the above embodiments, which are not described in detail herein.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the above-mentioned message pushing method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (15)

1. A server cluster, characterized in that the server cluster comprises a proxy server and at least three execution servers;
the proxy server is used for sending a first indication to a second execution server if receiving a message pushing request sent by a first terminal under the condition that a first execution server establishes a webpage port connection with the first terminal, wherein the message pushing request comprises identity information of the second terminal, and the second terminal is a terminal requested to be pushed by the message pushing request;
the second execution server is configured to search, according to the first indication, connection information of the second terminal in a shared storage system of the server cluster, where the connection information includes identity information of a third execution server, and the third execution server is an execution server that establishes a web port connection with the second terminal in the server cluster;
the proxy server is configured to receive connection information of the second terminal sent by the second execution server, and send a second indication to the first execution server, where the second indication includes identity information of the third execution server;
the first execution server is configured to send a third indication to the third execution server according to the second indication, where the third indication includes identity information of the second terminal;
the third execution server is used for pushing the webpage port message corresponding to the third indication to the second terminal under the condition that the webpage port connection is established with the second terminal;
wherein the first execution server and the third execution server are both developed based on non-blocking input/output.
2. The server cluster of claim 1, wherein the second execution server is a blocking input/output based development server according to hypertext transfer protocol.
3. A message pushing method applied to a proxy server in the server cluster of any one of claim 1 or claim 2, the method comprising:
under the condition that a first terminal establishes a webpage port connection with a first execution server, if a message pushing request sent by the first terminal is received, sending a first indication to a second execution server so that the second execution server searches connection information of a second terminal in a shared storage system of a server cluster according to the first indication, wherein the second terminal is a terminal requested to be pushed by the message pushing request, and the message pushing request comprises identity information of the second terminal;
receiving connection information of the second terminal sent by the second execution server, wherein the connection information includes identity information of a third execution server, and the third execution server is an execution server establishing a web port connection with the second terminal in the server cluster;
and sending a second indication to the first execution server to enable the first execution server to notify the third execution server to push the webpage port message corresponding to the message pushing request to the second terminal, wherein the second indication includes identity information of the third execution server.
4. A message pushing method applied to a first execution server, wherein the first execution server is the first execution server in the server cluster in any one of claim 1 or claim 2, and the method includes:
under the condition of establishing a webpage port connection with a first terminal, receiving a message pushing request sent by the first terminal, wherein the message pushing request comprises identity information of a second terminal requesting pushing;
if a second instruction sent by a proxy server is received, sending a third instruction to a third execution server so that the third execution server pushes a webpage port message corresponding to the message pushing request to the second terminal, wherein the third execution server is an execution server which establishes a webpage port connection with the second terminal in the server cluster, and the second instruction comprises identity information of the third execution server;
wherein the first execution server is a server developed based on non-blocking input/output.
5. The method of claim 4, wherein the message push request comprises a target message requesting to be pushed;
the step of sending a third instruction to the third execution server to enable the third execution server to push the web port message corresponding to the message push request to the second terminal includes:
sending a uniform resource locator request including the target message to the third execution server.
6. A message pushing method applied to a third execution server, where the third execution server is the third execution server in the server cluster in any one of claim 1 or claim 2, and the method includes:
under the condition of establishing webpage port connection with a second terminal, if a third instruction sent by the first execution server is received, pushing a webpage port message corresponding to the third instruction to the second terminal, wherein the third instruction comprises identity information of the second terminal;
wherein the third execution server is a server developed based on non-blocking input/output.
7. The method according to claim 6, wherein before the step of pushing the netpage port message corresponding to the third indication to the second terminal, the method further comprises:
and when web page port connection is established with the second terminal, adding the connection information of the second terminal into the shared storage system of the server cluster, wherein the connection information of the second terminal comprises the identity information of the third execution server.
8. The method of claim 7, wherein after the step of adding the connection information of the second terminal to the shared storage system of the server cluster, the method further comprises:
and when the webpage port connection with the second terminal is disconnected, deleting the connection information of the second terminal from the shared storage system.
9. A proxy server in the server cluster of any one of claim 1 or claim 2, the proxy server comprising:
a first sending module, configured to send a first indication to a second execution server if a message push request sent by a first terminal is received when the first terminal establishes a web port connection with the first execution server, so that the second execution server searches for connection information of a second terminal in a shared storage system of the server cluster according to the first indication, where the second terminal is a terminal requested to be pushed by the message push request, and the message push request includes identity information of the second terminal;
a receiving module, configured to receive connection information of the second terminal sent by the second execution server, where the connection information includes identity information of a third execution server, and the third execution server is an execution server that establishes a web port connection with the second terminal in the server cluster;
a second sending module, configured to send a second indication to the first execution server, so that the first execution server notifies the third execution server to push a web port message corresponding to the message push request to the second terminal, where the second indication includes identity information of the third execution server.
10. A first execution server, wherein the first execution server is the first execution server in the server cluster of any one of claim 1 or claim 2, and wherein the first execution server comprises:
the receiving module is used for receiving a message pushing request sent by a first terminal under the condition that the first execution server establishes a webpage port connection with the first terminal, wherein the message pushing request comprises identity information of a second terminal requesting pushing;
a sending module, configured to send a third instruction to a third execution server if a second instruction sent by a proxy server is received, so that the third execution server pushes a web port message corresponding to the message pushing request to the second terminal, where the third execution server is an execution server that establishes a web port connection with the second terminal in a server cluster, and the second instruction includes identity information of the third execution server;
wherein the first execution server is a server developed based on non-blocking input/output.
11. The first execution server of claim 10, wherein the message push request comprises a target message requesting push;
the sending module is used for:
sending a uniform resource locator request including the target message to the third execution server.
12. A third execution server, wherein the third execution server is a third execution server in the server cluster of any one of claim 1 or claim 2, and wherein the third execution server comprises:
the push module is used for pushing a webpage port message corresponding to a third instruction to a second terminal if the third instruction sent by a first execution server is received under the condition that webpage port connection is established with the second terminal, wherein the third instruction comprises identity information of the second terminal;
wherein the third execution server is a server developed based on non-blocking input/output;
the server cluster comprises a second execution server, the proxy server receives the connection information of the second terminal sent by the second execution server, and sends a second instruction to the first execution server, wherein the second instruction comprises the identity information of a third execution server;
and the first execution server sends a third instruction to the third execution server according to the second instruction.
13. The third execution server of claim 12, further comprising:
and the adding module is used for adding the connection information of the second terminal into the shared storage system of the server cluster when establishing the webpage port connection with the second terminal, wherein the connection information of the second terminal comprises the identity information of the third execution server.
14. The third execution server of claim 13, further comprising:
and the deleting module is used for deleting the connection information of the second terminal from the shared storage system when the webpage port connection with the second terminal is disconnected.
15. A server, comprising a transceiver, a bus interface, a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the message pushing method of any one of claims 3 to 7 when executing the computer program.
CN201811634939.8A 2018-12-29 2018-12-29 Server cluster, message pushing method and related server Active CN109600452B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811634939.8A CN109600452B (en) 2018-12-29 2018-12-29 Server cluster, message pushing method and related server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811634939.8A CN109600452B (en) 2018-12-29 2018-12-29 Server cluster, message pushing method and related server

Publications (2)

Publication Number Publication Date
CN109600452A CN109600452A (en) 2019-04-09
CN109600452B true CN109600452B (en) 2021-10-12

Family

ID=65964851

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811634939.8A Active CN109600452B (en) 2018-12-29 2018-12-29 Server cluster, message pushing method and related server

Country Status (1)

Country Link
CN (1) CN109600452B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112769671B (en) * 2019-10-21 2023-04-18 北京车和家信息技术有限公司 Message processing method, device and system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105897785A (en) * 2016-06-30 2016-08-24 宇龙计算机通信科技(深圳)有限公司 Method for managing application in combination with cloud data and terminal
CN107528891A (en) * 2017-08-04 2017-12-29 北京恒信仪和信息技术有限公司 A kind of automated cluster method and its system based on WebSocket
CN108377247A (en) * 2018-03-08 2018-08-07 北京车和家信息技术有限公司 A kind of information push method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170149915A1 (en) * 2015-11-25 2017-05-25 Sap Se System and method of feed data transmission

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105897785A (en) * 2016-06-30 2016-08-24 宇龙计算机通信科技(深圳)有限公司 Method for managing application in combination with cloud data and terminal
CN107528891A (en) * 2017-08-04 2017-12-29 北京恒信仪和信息技术有限公司 A kind of automated cluster method and its system based on WebSocket
CN108377247A (en) * 2018-03-08 2018-08-07 北京车和家信息技术有限公司 A kind of information push method and device

Also Published As

Publication number Publication date
CN109600452A (en) 2019-04-09

Similar Documents

Publication Publication Date Title
US9451046B2 (en) Managing CDN registration by a storage provider
US9241042B2 (en) In-server redirection of HTTP requests
EP2294515B1 (en) Request routing using network computing components
CN102299954B (en) For the context-specific network resource addressing system and method for Distributed Services
US8156243B2 (en) Request routing
CN110351283B (en) Data transmission method, device, equipment and storage medium
CN111917900B (en) Domain name agent request processing method and device
CN101895520B (en) Widget system data sharing method, server and data sharing system
CN102780711A (en) Method, device and system for accessing application data of SNS (Social Network Site)
KR100901281B1 (en) Method for ubiquitous web service
CN112003945A (en) Service request response method and device
CN110798495B (en) Method and server for end-to-end message push in cluster architecture mode
CN109600452B (en) Server cluster, message pushing method and related server
CN112769671B (en) Message processing method, device and system
CN111913817A (en) Data transmission method, system and equipment and computer readable storage medium
US20140068001A1 (en) Intermediate proxy server, communication method, and communication system based on http multi-level proxy
CN111726400A (en) Reverse connection method, device and server-side system
CN103561068A (en) Method and device for improving speed of web page browsing
CN108810070B (en) Resource sharing method and device, intelligent equipment and storage medium
CN106487861B (en) Network data providing method and device
CN104346228A (en) Application program sharing method and terminal
CN112202914A (en) Message pushing method and device
CN111953718A (en) Page debugging method and device
CN114979284B (en) 5G message scheduling method, device and system
US20200402115A1 (en) Serving an Online Advertisement Asynchronously

Legal Events

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

Effective date of registration: 20211122

Address after: Room 103, building 1, yard 4, Hengxing Road, Gaoliying Town, Shunyi District, Beijing

Patentee after: Beijing Rockwell Technology Co.,Ltd.

Address before: Room 801, 8 / F, building 3, No.10 courtyard, Wangjing street, Chaoyang District, Beijing 100102

Patentee before: BEIJING CHJ AUTOMOTIVE TECHNOLOGY Co.,Ltd.