CN109660607B - Service request distribution method, service request receiving method, service request distribution device, service request receiving device and server cluster - Google Patents

Service request distribution method, service request receiving method, service request distribution device, service request receiving device and server cluster Download PDF

Info

Publication number
CN109660607B
CN109660607B CN201811482752.0A CN201811482752A CN109660607B CN 109660607 B CN109660607 B CN 109660607B CN 201811482752 A CN201811482752 A CN 201811482752A CN 109660607 B CN109660607 B CN 109660607B
Authority
CN
China
Prior art keywords
message queue
service
target
queue cluster
cluster
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
CN201811482752.0A
Other languages
Chinese (zh)
Other versions
CN109660607A (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 Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud 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 Kingsoft Cloud Network Technology Co Ltd, Beijing Kingsoft Cloud Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN201811482752.0A priority Critical patent/CN109660607B/en
Publication of CN109660607A publication Critical patent/CN109660607A/en
Application granted granted Critical
Publication of CN109660607B publication Critical patent/CN109660607B/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/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
    • 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 embodiment of the invention provides a service request distribution method, a service request receiving method, a service request distribution device and a server cluster, wherein the service request distribution method is applied to a management server and comprises the following steps: acquiring a service request from a client; determining a message queue cluster corresponding to the service request from a plurality of pre-established message queue clusters as a target message queue cluster; and sending the service request to the target message queue cluster. The service request receiving method is applied to a service server, and comprises the following steps: determining a target message queue cluster corresponding to the service server in a plurality of pre-established message queue clusters; establishing a subscription relation between the service server and a target message queue cluster; and acquiring a target service request aiming at the service server from the target message queue cluster based on the subscription relation. The embodiment of the invention improves the processing efficiency of the service request.

Description

Service request distribution method, service request receiving method, service request distribution device, service request receiving device and server cluster
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a service request distribution method, a service request receiving apparatus, and a server cluster.
Background
In order to improve the service processing capability of the server side, a plurality of service servers may be grouped into a server cluster for processing a service request from a client. Currently, a server cluster framework for processing service requests may be as shown in fig. 1. The system comprises an Application Programming Interface (API), a message queue cluster and a service server, wherein the API is used for receiving a service request of a user and caching the service request into the message queue cluster, and the service server acquires the service request from the message queue cluster.
With the increase of the number of internet users and the increase of service complexity, the number and the scale of service servers in a server cluster also need to be increased correspondingly. When the number of the service servers is increased, in order to ensure that the message queue cluster can match the processing requirements of the service servers, the number of the message queues in the message queue cluster needs to be correspondingly increased, and more message queues are created to increase the processing capacity of the message queue cluster.
However, the processing capacity of a message queue cluster is non-linearly related to the number of message queues, and gradually flattens as the number of message queues in the message queue cluster increases. When the number of the service servers is large, the processing requirements of the service servers cannot be met only by increasing the number of the message queues in the message queue cluster, so that even if a larger number of service servers are added, the processing efficiency of the service requests cannot be improved.
Disclosure of Invention
Embodiments of the present invention provide a service request distribution method, a service request receiving method, a service request distribution device, and a server cluster, so as to improve efficiency of service request processing. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a service request distribution method, which is applied to a management server, and the method includes:
acquiring a service request from a client;
determining a message queue cluster corresponding to the service request from a plurality of pre-established message queue clusters as a target message queue cluster;
and sending the service request to the target message queue cluster.
Optionally, the determining, from a plurality of pre-created message queue clusters, a message queue cluster corresponding to the service request as a target message queue cluster includes:
determining target service attribute information of the service request;
determining a message queue cluster corresponding to the target service attribute information from a plurality of pre-created message queue clusters according to the corresponding relation between pre-stored service attribute information and the message queue clusters, and taking the message queue cluster as a target message queue cluster;
or
Determining a target service server of the service request;
and determining a message queue cluster corresponding to the target service server from a plurality of pre-established message queue clusters according to the corresponding relationship between the pre-stored service server and the message queue cluster, and taking the message queue cluster as the target message queue cluster.
Optionally, the corresponding relationship between the service attribute information and the message queue cluster is pre-stored in a preset database; the determining, according to a correspondence between pre-stored service attribute information and a message queue cluster, a message queue cluster corresponding to the target service attribute information from a plurality of pre-created message queue clusters includes:
and inquiring a preset database in which the corresponding relation between the service attribute information and the message queue cluster is stored in advance by taking the target service attribute information as an index so as to determine the message queue cluster corresponding to the target service attribute information.
Optionally, the preset database is a Redis database.
In a second aspect, an embodiment of the present invention discloses a service request receiving method, which is applied to a service server, and the method includes:
determining a target message queue cluster corresponding to the service server in a plurality of pre-established message queue clusters;
establishing a subscription relation between the service server and a target message queue cluster;
and acquiring a target service request aiming at the service server from the target message queue cluster based on the subscription relation.
Optionally, the determining a target message queue cluster corresponding to the service server in the plurality of message queue clusters created in advance includes:
determining a target message queue cluster corresponding to the service server from the plurality of pre-established message queue clusters according to a pre-stored corresponding relationship between the service server and the message queue clusters;
alternatively, the first and second electrodes may be,
and determining a target message queue cluster corresponding to the service attribute information from a plurality of pre-created message queue clusters according to the corresponding relationship between the pre-stored service attribute information and the message queue cluster and the service attribute information of the service server, wherein the target message queue cluster corresponding to the service attribute information is used as the target message queue cluster corresponding to the service server.
Optionally, the corresponding relationship between the service attribute information and the message queue cluster is pre-stored in a preset database;
determining, from a plurality of pre-created message queue clusters according to a correspondence between pre-stored service attribute information and a message queue cluster and service attribute information of the service server, a message queue cluster corresponding to the target service attribute information includes:
and inquiring a preset database which is stored with the corresponding relation between the service attribute information and the message queue cluster in advance by taking the service attribute information of the service server as an index so as to determine the message queue cluster corresponding to the service attribute information of the service server.
Optionally, the preset database is a Redis database.
Optionally, the establishing a subscription relationship between the service server and the target message queue cluster includes:
sending a connection establishment request to the target message queue cluster, wherein the connection establishment request comprises an identifier of the service server, so that the target message queue cluster allocates a message queue for the service server;
receiving confirmation information returned by the target message queue cluster;
the obtaining a target service request for the service server from the target message queue cluster based on the subscription relationship includes:
and monitoring the message queue of the service server in the subscribed target message queue cluster, and acquiring a target service request aiming at the service server from the message queue of the service server in the target message queue cluster when receiving a notification message of the change of the message queue.
In a third aspect, an embodiment of the present invention provides a service request distribution apparatus, which is applied to a management server, and the apparatus includes:
the service request acquisition module is used for acquiring a service request from a client;
a target message queue cluster determining module, configured to determine, from a plurality of message queue clusters created in advance, a message queue cluster corresponding to the service request as a target message queue cluster;
and the service request sending module is used for sending the service request to the target message queue cluster.
Optionally, the target message queue cluster determining module includes:
a target service attribute information determining submodule, configured to determine target service attribute information of the service request;
a first target message queue cluster determining submodule, configured to determine, according to a correspondence between pre-stored service attribute information and a message queue cluster, a message queue cluster corresponding to the target service attribute information from a plurality of pre-created message queue clusters, as a target message queue cluster;
or
A target service server determining submodule, configured to determine a target service server of the service request;
and the second target message queue cluster determining submodule is used for determining a message queue cluster corresponding to the target service server from a plurality of pre-established message queue clusters according to the corresponding relationship between the pre-stored service server and the message queue cluster, and the message queue cluster is used as the target message queue cluster.
Optionally, the corresponding relationship between the service attribute information and the message queue cluster is pre-stored in a preset database;
the first target message queue cluster determining submodule is specifically configured to query a preset database, in which a correspondence between the service attribute information and the message queue cluster is stored in advance, with the service attribute information of the service server as an index, so as to determine the message queue cluster corresponding to the service attribute information of the service server.
In a fourth aspect, an embodiment of the present invention provides a service request receiving apparatus, which is applied to a service server, and the apparatus includes:
the target message queue cluster determining module is used for determining a target message queue cluster corresponding to the service server in a plurality of pre-established message queue clusters;
a subscription relationship establishing module, configured to establish a subscription relationship between the service server and a target message queue cluster;
and the target service request acquisition module is used for acquiring a target service request aiming at the service server from the target message queue cluster based on the subscription relation.
Optionally, the target message queue cluster determining module includes:
a first target message queue cluster determining submodule, configured to determine, according to a correspondence between a pre-stored service server and a message queue cluster, a target message queue cluster corresponding to the service server from among the pre-created plurality of message queue clusters;
alternatively, the first and second electrodes may be,
and the second target message queue cluster determining submodule is used for determining a target message queue cluster corresponding to the service attribute information from a plurality of pre-established message queue clusters according to the corresponding relationship between the pre-stored service attribute information and the message queue cluster and the service attribute information of the service server, and using the target message queue cluster corresponding to the service attribute information as the target message queue cluster corresponding to the service server.
Optionally, the corresponding relationship between the service attribute information and the message queue cluster is pre-stored in a preset database;
the second target message queue cluster determining submodule is specifically configured to query, with the target service attribute information as an index, a preset database in which a correspondence between the service attribute information and the message queue cluster is stored in advance, so as to determine the message queue cluster corresponding to the target service attribute information.
Optionally, the subscription relationship establishing module includes:
a connection establishment request sending submodule, configured to send a connection establishment request to the target message queue cluster, where the connection establishment request includes an identifier of the service server, so that the target message queue cluster allocates a message queue for the service server;
the confirmation information receiving submodule is used for receiving the confirmation information returned by the target message queue cluster;
the target service request obtaining module is specifically configured to monitor a message queue of the service server in the subscribed target message queue cluster, and obtain a target service request for the service server from the message queue of the service server in the target message queue cluster when receiving a notification message of a change of the message queue.
In a fifth aspect, an embodiment of the present invention provides a management server, where a server cluster to which the management server belongs further includes multiple service servers, and the management server includes: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the method steps of any one of the service request distribution methods when executing the program stored in the memory.
In a sixth aspect, an embodiment of the present invention provides a service server, where a server cluster to which the service server belongs further includes a plurality of service servers, and the management server includes: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the method steps of any one of the service request receiving methods when executing the program stored in the memory.
In still another aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and the computer program is executed by a processor to perform the method steps of any of the service request distribution and reception methods described above.
In another aspect, an embodiment of the present invention provides a server cluster, where the server cluster includes: a management server and a plurality of service servers;
the management server is used for acquiring a service request from a client; determining a message queue cluster corresponding to the service request from a plurality of pre-established message queue clusters as a target message queue cluster; sending the service request to the target message queue cluster;
the service server is used for determining a target message queue cluster corresponding to the service server in a plurality of pre-established message queue clusters; establishing a subscription relation between the service server and a target message queue cluster; and acquiring a target service request aiming at the service server from the target message queue cluster based on the subscription relation.
The embodiment of the invention provides a service request distribution method, a service request receiving method, a service request distribution device and a server cluster, wherein in the service request distribution method, a management server determines a target message queue cluster corresponding to a service request from a plurality of pre-established message queue clusters, and the service request is sent to the target message queue cluster. In the service request receiving method, a target message queue cluster corresponding to the service server in a plurality of pre-established message queue clusters is determined; establishing a subscription relationship between the service server and a target message queue cluster; and acquiring a target service request aiming at the service server from the target message queue cluster based on the subscription relation. In the embodiment of the invention, each message queue cluster loads a certain amount of service servers through the pre-created plurality of message queue clusters, so that the load bottleneck of a single message queue cluster is avoided, the expandable number of service servers is increased, and the efficiency of processing the service request is improved. Moreover, the expansion of the service server is facilitated.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a prior art server cluster system framework diagram;
FIG. 2 is a diagram of a server cluster system framework according to an embodiment of the present invention;
fig. 3 is a flowchart of a service request distribution method according to an embodiment of the present invention;
fig. 4 is a flowchart of a service request receiving method according to an embodiment of the present invention;
fig. 5 is a flowchart of another service request receiving method according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a service request distribution apparatus according to an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of a service request receiving apparatus according to an embodiment of the present invention
FIG. 8 is a diagram illustrating a management server according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of a service server according to an embodiment of the present invention;
fig. 10 is a frame diagram of a server cluster system 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 only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 shows a conventional server cluster, and fig. 1 is a frame diagram of a server cluster system in the prior art. The system comprises an API interface, a message queue cluster and a plurality of service servers, wherein the message queue cluster comprises a plurality of message queues. All back-end service servers under the API interface subscribe the message of the message queue cluster. When the number of the service servers is expanded, in order to meet the requirement of the service servers for message subscription, the number of the message queues in the message queue cluster is correspondingly increased. The processing capacity of a message queue cluster gradually flattens as the number of message queues in the message queue cluster increases. When the number of the service servers is large, the processing requirements of the service servers cannot be met only by increasing the number of the message queues in the message queue cluster, so that even if a larger number of service servers are added, the processing efficiency of the service requests cannot be improved, and therefore, the expansion of the number of the back-end service servers, that is, the expansion of services is limited.
In view of this, embodiments of the present invention provide a service request distribution method, a service request receiving method, a service request distribution device, and a server cluster, so as to achieve the purpose of improving service request processing efficiency and facilitate service expansion.
Optionally, referring to fig. 2, fig. 2 is a frame diagram of a server cluster system according to an embodiment of the present invention. Including a management server 201, a plurality of message queue clusters 202, and a plurality of business servers 203. The management server 201, that is, a server for distributing service requests, may include an API interface, and each message queue cluster may include a plurality of message queues. One service server can only subscribe one message queue cluster, namely, one service server only corresponds to one message queue cluster; a message queue cluster may include message queues to which multiple service servers subscribe, that is, a message queue cluster corresponds to multiple service servers, and in a message queue cluster, one service server may correspond to at least one message queue.
In a first aspect, an embodiment of the present invention discloses a service request distribution method, which is shown in fig. 3. Fig. 3 is a flowchart of a service request distribution method according to an embodiment of the present invention, which is applied to a management server and includes:
s301, acquiring a service request from a client.
The service request distribution method of the embodiment of the invention is applied to the management server, the management server can be a physical machine or a virtual machine, and the service request distribution method of the embodiment of the invention is realized when the management server runs.
The management server receives a service request through the API interface, the service request being originally made by the client. And after receiving the service request, the management server determines a corresponding target message queue cluster.
S302, determining a message queue cluster corresponding to the service request from a plurality of pre-created message queue clusters as a target message queue cluster.
Optionally, the step S302 of determining, from a plurality of pre-created message queue clusters, a message queue cluster corresponding to the service request as a target message queue cluster includes:
step one, determining the target service attribute information of the service request.
The service attribute information may include a service type that the service server is requested to process. For example, for a game server system, the attribute information of the service request may be game scene information; or the attribute information of the service request can be game mall information, or the attribute information of the service request can be player chat information and the like.
The service attribute information may also include software and hardware attributes of the service server, such as the number of CPU cores, memory, and the like.
The management server may determine target service attribute information for the service request from the service request.
And step two, determining a message queue cluster corresponding to the target service attribute information from a plurality of pre-created message queue clusters according to the corresponding relation between the pre-stored service attribute information and the message queue cluster, and taking the message queue cluster as the target message queue cluster.
Optionally, the correspondence between the service attribute information and the message queue cluster is pre-stored in a preset database; the determining, according to a correspondence between pre-stored service attribute information and a message queue cluster, a message queue cluster corresponding to the target service attribute information from a plurality of pre-created message queue clusters includes:
and inquiring a preset database in which the corresponding relation between the service attribute information and the message queue cluster is stored in advance by taking the target service attribute information as an index so as to determine the message queue cluster corresponding to the target service attribute information.
Namely, the server cluster of the present invention further includes a preset database, and the corresponding relationship between the service attribute information and the message queue cluster is stored in the preset database in advance. Optionally, the preset database is a Redis database. And after the management server receives the service request, querying the database so as to obtain the message queue cluster corresponding to the service request. It should be noted that the service server may also obtain the corresponding relationship between the service attribute information and the message queue cluster from the database, and further determine the message queue cluster corresponding to the service server based on the service attribute information of the service server, so as to establish a subscription relationship, that is, to facilitate expansion of the service server.
For example, for a game server system, the Redis database stores the corresponding relationship between game scene information and a designated message queue cluster; storing the corresponding relation between the user login information and the designated message queue cluster in the Redis database; the Redis database stores the corresponding relationship between the chat information of the player and the designated message queue cluster, and the like.
And after receiving the service request, the management server queries a message queue cluster corresponding to the target service attribute information in a Redis database by taking the target service attribute information as an index, and takes the message queue cluster as a target message queue cluster. Specifically, the management server may send the target service attribute information to a Redis database, and receive a message queue cluster corresponding to the target service attribute information, which is fed back by the database.
Or, determining a message queue cluster corresponding to the service request from a plurality of pre-created message queue clusters, as a target message queue cluster, which may be:
step one, determining a target service server of the service request;
and acquiring the carried indication information from the service request, and determining a target service server of the service request. Wherein, the indication information is used for indicating a service server for processing the service request.
The service request carries indication information indicating a service server for processing the service request. The indication information may be an identification of the user, for example, an account number or an ID of the user; the indication information may also be an address of the client or a service type requested to be processed by the service request, etc. And the management server acquires the indication information carried by the service request and determines a target service server for processing the service request from the indication information.
And step two, determining a message queue cluster corresponding to the target service server from a plurality of pre-established message queue clusters according to the corresponding relationship between the pre-stored service server and the message queue cluster, and taking the message queue cluster as the target message queue cluster.
Similarly, a database, such as a Redis database, may be preset, the corresponding relationship between the service server and the message queue cluster is stored in the database, and the target message queue cluster is determined by querying the database.
The service servers and the message queue clusters in the embodiment of the invention have a subscription relationship, one service server only subscribes to one message queue cluster, and one message queue cluster is subscribed by a plurality of service servers. The subscription relationship between the service server and the message queue cluster may be stored in a preset database. And the management server reads the message queue cluster corresponding to the target service server from the database, and takes the uniquely subscribed message queue cluster as a target message queue cluster.
S303, the service request is sent to the target message queue cluster.
And the management server sends the service request to the target message queue cluster, namely, the service request is cached in the target message queue cluster.
The embodiment of the invention provides a service request distribution method, which comprises the steps of setting a plurality of message queue clusters, determining a target message queue cluster corresponding to a service request from a plurality of pre-established message queue clusters through a management server, and sending the service request to the target message queue cluster. Acquiring a service request from a client through a management server; determining a message queue cluster corresponding to the service request from a plurality of message queue clusters established in advance as a target message queue cluster; and sending the service request to the target message queue cluster. The target message queue cluster corresponding to the current service request is determined from a plurality of message queue clusters which are created in advance, and the service request is sent to the target message queue cluster, so that each message queue cluster loads a certain amount of service servers, the load bottleneck of a single message queue cluster is avoided, the efficiency of processing the service request is improved, and the service servers are conveniently expanded.
Corresponding to the service request distribution method in the first aspect, in the second aspect, an embodiment of the present invention provides a service request receiving method, see fig. 4. Fig. 4 is a flowchart of a service request receiving method according to an embodiment of the present invention, which is applied to a service server and includes:
s401, determining a target message queue cluster corresponding to the service server in a plurality of pre-created message queue clusters.
The service request receiving method of the embodiment of the invention is applied to a service server, the service server can be a back-end server for processing a client request, and the service server realizes the service request receiving method of the embodiment of the invention when in operation.
After being powered on, the service server can firstly determine a target message queue cluster corresponding to the service server from a plurality of pre-created message queue clusters. For example, when a new service server is added, the new service server may determine a message queue cluster corresponding to the new service server from a plurality of message queue clusters created in advance, and further establish a subscription relationship, and put the subscription relationship into receiving and processing of a service request.
Optionally, the determining, in the S401, a target message queue cluster corresponding to the service server in the plurality of message queue clusters created in advance includes:
and determining a target message queue cluster corresponding to the service server from the plurality of pre-created message queue clusters according to the corresponding relationship between the pre-stored service server and the message queue cluster.
Specifically, the service server may use its own identifier as an index, search for a message queue cluster corresponding to its own identifier in a preset database that stores a correspondence relationship between the service server and the message queue cluster in advance, and use the message queue cluster as a target message queue cluster. The identification may be an ID, name, port, etc. of the service server.
Or, according to a correspondence between pre-stored service attribute information and a message queue cluster and the service attribute information of the service server, determining a target message queue cluster corresponding to the service attribute information from a plurality of pre-created message queue clusters as a target message queue cluster corresponding to the service server.
Optionally, the correspondence between the service attribute information and the message queue cluster is pre-stored in a preset database.
The determining, according to a correspondence between pre-stored service attribute information and a message queue cluster and service attribute information of the service server, a message queue cluster corresponding to the target service attribute information from a plurality of pre-created message queue clusters includes:
and inquiring a preset database which is stored with the corresponding relation between the service attribute information and the message queue cluster in advance by taking the service attribute information of the service server as an index so as to determine the message queue cluster corresponding to the service attribute information of the service server.
The service attribute information represents the service type processed by the service server. The preset database may store a corresponding relationship between the service attribute information and the message queue cluster, and optionally, the preset database is a Redis database. For example, for a game server system, the Redis database may store a corresponding relationship between game scene information and a designated message queue cluster; storing the corresponding relation between the user login information and the designated message queue cluster in the Redis database; the Redis database stores the corresponding relationship between the chat information of the player and the designated message queue cluster, and the like. The service server takes the self service attribute information as target service attribute information, takes the target service attribute information as an index, searches a message queue cluster corresponding to the target service attribute information from a preset database, and determines the message queue cluster as the target message queue cluster corresponding to the self service server.
The service attribute information may also include software and hardware attributes of the service server, such as the number of CPU cores, memory, and the like.
S402, establishing the subscription relationship between the service server and the target message queue cluster.
S403, based on the subscription relationship, obtaining a target service request for the service server from the target message queue cluster.
In a service request receiving method provided by an embodiment of the present invention, a target message queue cluster corresponding to a service server in a plurality of message queue clusters created in advance is determined; establishing a subscription relationship between the service server and a target message queue cluster; and acquiring a target service request aiming at the service server from the target message queue cluster based on the subscription relation. In the embodiment of the invention, each message queue cluster loads a certain amount of service servers through the subscription relationship between the service servers and the target message queue cluster, so that the load bottleneck of a single message queue cluster is avoided, the expandable number of the service servers is increased, and the efficiency of processing the service request is improved.
Optionally, in an embodiment of the service request receiving method of the present invention, the S402 establishes a subscription relationship between the service server and the target message queue cluster, as shown in fig. 5. Fig. 5 is a flowchart of another service request receiving method according to an embodiment of the present invention, including:
s501, sending a connection establishment request to the target message queue cluster, where the connection establishment request includes an identifier of the service server, so that the target message queue cluster allocates a message queue for the service server.
For example, after a service server is powered on, the service server sends a connection establishment request to a target message queue cluster.
And S502, receiving the confirmation information returned by the target message queue cluster.
The message queue cluster receives the connection establishment request, the target message queue cluster can judge a sender sending the connection establishment request, namely whether the service attribute information of the service server sending the connection establishment request is the same as the service attribute information of the message queue cluster of the target message queue cluster, if the service attribute information of the service server sending the connection establishment request is the same as the service attribute information of the message queue cluster of the target message queue cluster, the message queue is distributed to the service server, and confirmation information is returned to the service server. And the service server receives the confirmation information returned by the target message queue cluster.
The step S403 of obtaining the target service request for the service server from the target message queue cluster based on the subscription relationship includes:
s503, monitoring the message queue of the service server in the subscribed target message queue cluster, and when receiving the notification message of the change of the message queue, acquiring a target service request for the service server from the message queue of the service server in the target message queue cluster.
After the service server establishes a subscription relationship with the message queue, the service server may establish at least one target message queue using its own identifier as a message queue identifier in the resource allocated to itself by the target message queue cluster. The service server monitors a target message queue in a target message queue cluster, and when a notification message of message queue change is received, a target service request is obtained from the target message queue in the target message queue cluster.
In the embodiment of the invention, the business server and the target message queue cluster can establish a subscription relation, so that the business server acquires the target business request corresponding to the business server by monitoring the change of the corresponding target message queue cluster.
Exemplarily, referring to fig. 10, fig. 10 is a framework diagram of a server cluster system according to an embodiment of the present invention. The method comprises the following steps: a management server 1001, a plurality of message queue clusters 1002, a plurality of business servers 1003, and a database 1004, which may be a Redis database. The management server 1001 may include an API interface, and may include a plurality of message queues in each message queue cluster.
The database 1004 stores a correspondence between the message queue cluster and the service server, for example, the database 1004 stores a correspondence between the service attribute information and the message queue cluster in advance, or stores a correspondence between the service server and the message queue cluster in advance. The management server 1001 may access the database 1004 after receiving the service request, determine a target message queue cluster of the service request according to a correspondence relationship pre-stored in the database 1004, and then send the service request to the target message queue cluster.
When each service server 1003 is put into use for the first time or restarted after downtime, the database 1004 can be accessed, the target message queue cluster corresponding to the service server is determined according to the corresponding relation pre-stored in the database 1004, then, the subscription relation between the service server and the target message queue cluster is established, and the target service request to be processed is obtained in the target message queue cluster corresponding to the service server. The specific process is as follows:
step one, the corresponding relation of a plurality of message queue clusters 1002 created correspondingly according to the service attribute information of the service server 1004 is stored in the database 1004. The service attribute information may include a service type requested to be processed by the service server 1003. The service attribute information may further include software and hardware attributes of the service server 1003, such as the number of CPU cores, memory capacity, memory model, CPU model, and the like.
Step two, after the service server 1003 is powered on, the service server may access the database 1004 by using the service attribute information of the service server itself as an index, search the message queue cluster 1002 corresponding to the service attribute information of the service server itself in the database 1004 as a target message queue cluster, then establish a subscription relationship with the target message queue cluster, and at the same time, the service server 1003 creates a message queue marked with a service server identifier in the target message queue cluster, and may monitor changes of the message queue.
Step three, the management server 1001 acquires the service request from the client, accesses the database 1004 by using the target service attribute information corresponding to the service request as the index information, and searches the message queue cluster 1002 corresponding to the target service attribute information in the database 1004 as the target message queue cluster. The service request is sent to the target message queue cluster.
Step four, the target message queue cluster will extract the service server identification information in the service request, and cache the service request into the message queue corresponding to the service server 1003 based on the identification information. Since the service server 1003 listens to the message queue, the message queue cluster notifies the service server of the message queue change.
Step five, after the service server 1003 monitors that the target message queue cluster corresponding to itself changes, the target service request for the service server itself is acquired from the target message queue cluster corresponding to itself.
It should be noted that, the above step two and step three may be performed simultaneously, or the step three is performed first and then the step two is performed, which all fall within the scope of the service request receiving method and the service request sending method of the present invention, and the present invention is not limited herein.
When a service server needs to be added, the newly added service server can determine a target message queue cluster based on the interaction with the database, and when a certain number of service servers are added, the number of message queue clusters can be correspondingly increased, and only the corresponding relation between the message queue clusters and the service attribute information needs to be configured, so that the network architecture is very convenient for performing the transverse expansion of a service layer.
Therefore, in the server cluster system of the embodiment of the invention, the corresponding relationship between the message queue cluster and the service server can be stored in the database in advance, the service server accesses the database to determine the target message queue cluster corresponding to the service server, and then the subscription relationship between the service server and the target message queue cluster is established. And accessing the database through the management server, determining a target message queue cluster corresponding to the current service request, and sending the service request to the target message queue cluster. In the embodiment of the invention, a plurality of message queue clusters are created, so that each message queue cluster loads a certain amount of service servers, the load bottleneck of a single message queue cluster is avoided, the efficiency of processing the service request is improved, and the service servers are conveniently and transversely expanded.
The multiple message queue clusters of the embodiment of the invention are created by queue nodes. The specific process is as follows:
optionally, the step of creating a plurality of message queue clusters in advance includes:
step one, grouping the service servers according to the service attribute information of the service servers to obtain a plurality of server groups.
And acquiring the service attribute information of each service server, and grouping the service servers according to the service attribute information to obtain a plurality of server groups. The service attribute information represents the service type of the service server load. For example, for one game server system, the service servers that process game scene data are divided into one group, the service servers that process game mall data are divided into one group, and the service servers that process player chat data are divided into one group, and so on.
And step two, establishing a corresponding message queue cluster for each server group according to the service attribute information of the service server in each server group.
And establishing a corresponding message queue cluster for each server group according to the service attribute information of the service server in each server group. For example, for a server group processing player chatting data, a message queue cluster dedicated to processing player chatting data is established; and aiming at the server group for processing the user login data, establishing a message queue cluster specially used for processing the user login data, and the like. And storing the corresponding relation between the service attribute information and the message queue cluster in a preset database.
In the embodiment of the invention, the message queue cluster corresponding to the server grouping is established according to the service attribute information, and the message queue cluster aiming at the corresponding service request type can be established, so that the processing efficiency of the service request can be improved.
Optionally, the step of creating a plurality of message queue clusters in advance includes:
step one, determining the total load capacity of each service server in the server cluster.
And respectively acquiring the load capacity of each service server, and calculating the sum of the load capacities of all the service servers in the server cluster, namely the total load capacity of all the service servers.
And step two, establishing a plurality of message queue clusters according to the total load capacity, wherein the total service request processing capacity of each message queue cluster is not less than the total service request processing capacity of each service server.
And establishing a plurality of message queue clusters according to the total load capacity of each service server in the server cluster. For example, a plurality of message queue clusters with the same load capacity are established, or a message queue cluster with corresponding load capacity is established according to the total load of each service server in a server group corresponding to the message queue cluster. When a message queue cluster is established, the total service request processing capacity of each message queue cluster should be guaranteed to be not less than the total service request processing capacity of each service server. For example, each service server can process 800 service requests in total per unit time, and the number of the service requests that can be processed in total per unit time of each message queue cluster is not less than 800.
In the process of actually establishing the message queue cluster, in order to ensure the service request processing efficiency of the service server at the back end, prevent the message queue cluster from becoming a processing bottleneck of the server system, and simultaneously, in order to facilitate the expansion of the service server in the server system at the back end, the total message processing capacity of the message queue cluster is generally greater than the total message processing capacity of each service server, for example, each service server can process 800 service requests in total in unit time, and the total number of the service requests that can be processed in each message queue cluster in unit time is 900 or 1000.
In the embodiment of the invention, a plurality of message queue clusters are established according to the total load capacity of each service server, the total service request processing capacity of each message queue cluster is ensured to be not less than the total service request processing capacity of each service server, and the working efficiency of each service server at the rear end can be ensured.
Optionally, for each message queue cluster, after the message queue cluster receives the subscription request sent by the service server, the size of the load of the message queue cluster and a preset load threshold is determined, and when the load of the message queue cluster is smaller than the preset load threshold, the service server sending the subscription request is allowed to subscribe the message queue cluster.
For each message queue cluster, receiving a subscription request sent by a service server at the message queue cluster, acquiring the current load of the message queue cluster, comparing the load of the message queue cluster with a preset load threshold value, and allowing the service server sending the subscription request to subscribe the message queue cluster if the load of the message queue cluster is smaller than the preset load threshold value; and if the load of the message queue cluster is not less than the preset load threshold, prohibiting the service server sending the subscription request from subscribing the message queue cluster. The preset load threshold may be set according to actual conditions, for example, set to 90%, 95%, or 100% of the load capacity of the message queue cluster.
In the embodiment of the invention, whether the service server is allowed to subscribe the message queue cluster is judged by judging the load of the message queue cluster and the size of the preset load threshold, so that the problem of low service request processing efficiency caused by overload of the message queue cluster can be solved.
Optionally, when there is a message queue cluster with a load greater than a preset load threshold, selecting a service server to be migrated from service servers subscribing to the message queue cluster; newly building a message queue cluster as a newly-added target message queue cluster; and migrating the subscription service of the service server to be migrated to the newly added target message queue cluster.
And monitoring the load of each message queue cluster, and selecting a service server to be migrated from the service servers subscribing the message queue cluster when the message queue cluster with the load larger than a preset load threshold exists. For example, a service server is randomly selected from the service servers subscribing to the message queue cluster as a service server to be migrated, or a service server with the largest number of service requests is preferentially selected as a service server to be migrated, and the like.
One or more message queue clusters can be newly built according to the service attribute information of the service server to be migrated, and the message queue clusters are used as newly-added target message queue clusters.
And each service server to be migrated can be migrated to the newly added target message queue cluster in sequence, or all the service servers to be migrated can be migrated to the newly added target message queue cluster in parallel. Each to-be-subscribed message queue cluster may receive one or more to-be-migrated service servers, but it should be ensured that after the to-be-subscribed message queue cluster receives the to-be-migrated service server, the load of the to-be-subscribed message queue cluster is not greater than the preset load threshold.
And storing the migrated service server and the message queue cluster according to the service attribute information. For example, if the service attribute information of the message queue cluster where the service server to be migrated is currently located is a game mall, the correspondence between the service attribute information stored in the preset database and the message queue cluster may be: and modifying the game mall message queue cluster into a mark first game mall message queue cluster, and recording the newly added message queue cluster in a preset database as a second game mall message queue cluster and a third game mall message queue cluster.
In the embodiment of the invention, when the load of the message queue cluster is greater than the preset load threshold value, the service server subscribing the message queue cluster is transferred to the newly added message queue cluster, so that the overload condition of the message queue cluster is reduced, and the problem of low service request processing efficiency caused by overload of the message queue cluster is reduced.
In a third aspect, an embodiment of the present invention discloses a service request distribution apparatus, see fig. 6. Applied to the management server, the device comprises:
a service request obtaining module 601, configured to obtain a service request from a client;
a target message queue cluster determining module 602, configured to determine, from a plurality of message queue clusters created in advance, a message queue cluster corresponding to the service request as a target message queue cluster;
a service request sending module 603, configured to send the service request to the target message queue cluster.
In the service request distribution device provided by the embodiment of the invention, a management server determines a target message queue cluster corresponding to a service request from a plurality of pre-established message queue clusters, and sends the service request to the target message queue cluster. Acquiring a service request from a client through a management server; determining a message queue cluster corresponding to the service request from a plurality of message queue clusters established in advance as a target message queue cluster; and sending the service request to the target message queue cluster. The target message queue cluster corresponding to the current service request is determined from a plurality of message queue clusters which are created in advance, and the service request is sent to the target message queue cluster, so that each message queue cluster loads a certain amount of service servers, the load bottleneck of a single message queue cluster is avoided, and the efficiency of processing the service request is improved. Moreover, the expansion of the service server is facilitated.
Optionally, in an embodiment of the service request distribution apparatus of the present invention, the target message queue cluster determining module 602 includes:
a target service attribute information determining submodule for determining target service attribute information of the service request;
a first target message queue cluster determining submodule, configured to determine, from a plurality of message queue clusters created in advance, a message queue cluster corresponding to the target service attribute information as a target message queue cluster according to a correspondence between prestored service attribute information and the message queue cluster;
or
A target service server determining submodule for determining a target service server of the service request;
and the second target message queue cluster determining submodule is used for determining a message queue cluster corresponding to the target service server from a plurality of pre-established message queue clusters according to the corresponding relationship between the pre-stored service server and the message queue cluster, and the message queue cluster is used as the target message queue cluster.
Optionally, in an embodiment of the service request distribution apparatus of the present invention, a correspondence between the service attribute information and the message queue cluster is pre-stored in a preset database;
the first target message queue cluster determining submodule is specifically configured to query, using the target service attribute information as an index, a preset database in which a correspondence between the service attribute information and the message queue cluster is stored in advance, so as to determine the message queue cluster corresponding to the target service attribute information.
In a fourth aspect, an embodiment of the present invention discloses a service request receiving apparatus, see fig. 7. Applied to the business server, the above-mentioned device includes:
a target message queue cluster determining module 701, configured to determine a target message queue cluster corresponding to the service server in a plurality of pre-created message queue clusters;
a subscription relationship establishing module 702, configured to establish a subscription relationship between the service server and the target message queue cluster;
a target service request obtaining module 703, configured to obtain, based on the subscription relationship, a target service request for the service server from the target message queue cluster.
In a service request receiving apparatus provided in an embodiment of the present invention, a target message queue cluster corresponding to a service server in a plurality of message queue clusters created in advance is determined; establishing a subscription relationship between the service server and a target message queue cluster; and acquiring a target service request aiming at the service server from the target message queue cluster based on the subscription relation. In the embodiment of the invention, each message queue cluster loads a certain amount of service servers through the subscription relationship between the service servers and the target message queue cluster, so that the load bottleneck of a single message queue cluster is avoided, the expandable number of the service servers is increased, and the efficiency of processing the service request is improved. Moreover, the expansion of the service server is facilitated.
Optionally, in an embodiment of the service request receiving apparatus of the present invention, the target message queue cluster determining module 701 includes:
a first target message queue cluster determining submodule, configured to determine, according to a correspondence between a pre-stored service server and a message queue cluster, a target message queue cluster corresponding to the service server from among the plurality of pre-created message queue clusters;
alternatively, the first and second electrodes may be,
and a second target message queue cluster determining submodule, configured to determine, according to a correspondence between pre-stored service attribute information and a message queue cluster and the service attribute information of the service server, a target message queue cluster corresponding to the service attribute information from a plurality of pre-created message queue clusters, as a target message queue cluster corresponding to the service server.
Optionally, in an embodiment of the service request distribution apparatus of the present invention, a correspondence between the service attribute information and the message queue cluster is pre-stored in a preset database;
the second target message queue cluster determining submodule is specifically configured to query, using the target service attribute information as an index, a preset database in which a correspondence between the service attribute information and the message queue cluster is stored in advance, so as to determine the message queue cluster corresponding to the target service attribute information.
Optionally, in an embodiment of the service request distribution apparatus of the present invention, the subscription relationship establishing module 702 includes:
a connection establishment request sending submodule, configured to send a connection establishment request to the target message queue cluster, where the connection establishment request includes an identifier of the service server, so that the target message queue cluster allocates a message queue for the service server;
a confirmation information receiving submodule, configured to receive confirmation information returned by the target message queue cluster;
the target service request obtaining module 703 is specifically configured to monitor a message queue of the service server in the subscribed target message queue cluster, and obtain a target service request for the service server from the message queue of the service server in the target message queue cluster when receiving a notification message of the change of the message queue.
In a fifth aspect, an embodiment of the present invention discloses a management server, and referring to fig. 8, fig. 8 is a schematic diagram of a management server according to an embodiment of the present invention. The management server includes: the system comprises a processor 801, a communication interface 802, a memory 803 and a communication bus 804, wherein the processor 801, the communication interface 802 and the memory 803 complete mutual communication through the communication bus 804;
a memory 803 for storing a computer program;
the processor 801 is configured to implement the following method steps when executing the program stored in the memory 803:
acquiring a service request from a client;
determining a message queue cluster corresponding to the service request from a plurality of message queue clusters established in advance as a target message queue cluster;
and sending the service request to the target message queue cluster.
The communication bus 804 mentioned above as the management server may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus 804 may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface 802 is used for communication between the above-described electronic apparatus and other apparatuses.
The Memory 803 may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory 803 may also be at least one storage device located remotely from the processor 801.
The Processor 801 may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
In the electronic device provided in the embodiments of the present invention, a management server determines a target message queue cluster corresponding to a service request from a plurality of pre-established message queue clusters, and sends the service request to the target message queue cluster. Acquiring a service request from a client through a management server; determining a message queue cluster corresponding to the service request from a plurality of message queue clusters established in advance as a target message queue cluster; and sending the service request to the target message queue cluster. The target message queue cluster corresponding to the current service request is determined from a plurality of message queue clusters which are created in advance, and the service request is sent to the target message queue cluster, so that each message queue cluster loads a certain amount of service servers, the load bottleneck of a single message queue cluster is avoided, and the efficiency of processing the service request is improved. Moreover, the expansion of the service server is facilitated.
In a sixth aspect, an embodiment of the present invention discloses a service server, referring to fig. 9, where fig. 9 is a schematic diagram of a service server according to an embodiment of the present invention. The service server includes: the system comprises a processor 901, a communication interface 902, a memory 903 and a communication bus 904, wherein the processor 901, the communication interface 902 and the memory 903 are communicated with each other through the communication bus 904;
a memory 903 for storing computer programs;
the processor 901 is configured to implement the following method steps when executing the program stored in the memory 903:
determining a target message queue cluster corresponding to the service server in a plurality of pre-established message queue clusters;
establishing a subscription relation between the service server and a target message queue cluster;
and acquiring a target service request aiming at the service server from the target message queue cluster based on the subscription relation.
The communication bus 904 mentioned above as the management server may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus 904 may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface 902 is used for communication between the electronic apparatus and other apparatuses.
The Memory 903 may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory 903 may also be at least one storage device located remotely from the processor 901.
The Processor 901 may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
In an electronic device provided in an embodiment of the present invention, a target message queue cluster corresponding to a service server in a plurality of message queue clusters created in advance is determined; establishing a subscription relationship between the service server and a target message queue cluster; and acquiring a target service request aiming at the service server from the target message queue cluster based on the subscription relation. In the embodiment of the invention, each message queue cluster loads a certain amount of service servers through the subscription relationship between the service servers and the target message queue cluster, so that the load bottleneck of a single message queue cluster is avoided, the expandable number of the service servers is increased, and the efficiency of processing the service request is improved. Moreover, the expansion of the service server is facilitated.
In another aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and the computer program is executed by a processor to perform any one of the above method steps of the service request distribution and reception method.
In a computer-readable storage medium according to an embodiment of the present invention, a management server determines a target message queue cluster corresponding to a service request from a plurality of message queue clusters established in advance, and sends the service request to the target message queue cluster. In the service request receiving method, a target message queue cluster corresponding to the service server in a plurality of pre-established message queue clusters is determined; establishing a subscription relationship between the service server and a target message queue cluster; and acquiring a target service request aiming at the service server from the target message queue cluster based on the subscription relation. In the embodiment of the invention, each message queue cluster loads a certain amount of service servers through the pre-created plurality of message queue clusters, so that the load bottleneck of a single message queue cluster is avoided, the expandable number of service servers is increased, and the efficiency of processing the service request is improved. Moreover, the expansion of the service server is facilitated.
In another aspect, an embodiment of the present invention provides a server cluster, where the server cluster includes: a management server and a plurality of service servers;
the management server is used for acquiring a service request from a client; determining a message queue cluster corresponding to the service request from a plurality of message queue clusters established in advance as a target message queue cluster; sending the service request to the target message queue cluster;
the service server is configured to determine a target message queue cluster corresponding to the service server from a plurality of message queue clusters created in advance; establishing a subscription relation between the service server and a target message queue cluster; and acquiring a target service request aiming at the service server from the target message queue cluster based on the subscription relation.
The server cluster comprises a management server and a plurality of service servers, wherein a target message queue cluster corresponding to a service request is determined from a plurality of pre-established message queue clusters through the management server, and the service request is sent to the target message queue cluster. In the service request receiving method, a target message queue cluster corresponding to the service server in a plurality of pre-established message queue clusters is determined; establishing a subscription relationship between the service server and a target message queue cluster; and acquiring a target service request aiming at the service server from the target message queue cluster based on the subscription relation. In the embodiment of the invention, each message queue cluster loads a certain amount of service servers through the pre-created plurality of message queue clusters, so that the load bottleneck of a single message queue cluster is avoided, the expandable number of service servers is increased, and the efficiency of processing the service request is improved. Moreover, the expansion of the service server is facilitated.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the device and server cluster embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to part of the description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (20)

1. A service request distribution method is applied to a management server, and comprises the following steps:
acquiring a service request from a client;
determining a message queue cluster corresponding to the service request from a plurality of pre-established message queue clusters as a target message queue cluster;
and sending the service request to the target message queue cluster, so that a service server determines a target message queue cluster corresponding to the service server in a plurality of pre-created message queue clusters, establishes a subscription relationship between the service server and the target message queue cluster, and acquires the target service request aiming at the service server from the target message queue cluster based on the subscription relationship.
2. The method according to claim 1, wherein the determining, as a target message queue cluster, a message queue cluster corresponding to a service request from a plurality of pre-created message queue clusters comprises:
determining target service attribute information of the service request;
determining a message queue cluster corresponding to the target service attribute information from a plurality of pre-created message queue clusters according to the corresponding relation between pre-stored service attribute information and the message queue clusters, and taking the message queue cluster as a target message queue cluster;
or
Determining a target service server of the service request;
and determining a message queue cluster corresponding to the target service server from a plurality of pre-established message queue clusters according to the corresponding relationship between the pre-stored service server and the message queue cluster, and taking the message queue cluster as the target message queue cluster.
3. The method according to claim 2, wherein the correspondence between the service attribute information and the message queue cluster is pre-stored in a preset database;
the determining, according to a correspondence between pre-stored service attribute information and a message queue cluster, a message queue cluster corresponding to the target service attribute information from a plurality of pre-created message queue clusters includes:
and inquiring a preset database in which the corresponding relation between the service attribute information and the message queue cluster is stored in advance by taking the target service attribute information as an index so as to determine the message queue cluster corresponding to the target service attribute information.
4. The method of claim 3, wherein the predetermined database is a Redis database.
5. A service request receiving method, applied to a service server, the method comprising:
determining a target message queue cluster corresponding to the service server in a plurality of pre-established message queue clusters;
establishing a subscription relation between the service server and a target message queue cluster;
acquiring a target service request aiming at the service server from the target message queue cluster based on the subscription relation; wherein, the target service request is: the management server acquires a service request from a client, determines a message queue cluster corresponding to the service request from a plurality of pre-established message queue clusters as a target message queue cluster, and sends the service request to the target message queue cluster.
6. The method of claim 5, wherein determining a target message queue cluster of the pre-created plurality of message queue clusters corresponding to the traffic server comprises:
determining a target message queue cluster corresponding to the service server from the plurality of pre-established message queue clusters according to a pre-stored corresponding relationship between the service server and the message queue clusters;
alternatively, the first and second electrodes may be,
and determining a target message queue cluster corresponding to the service attribute information from a plurality of pre-created message queue clusters according to the corresponding relationship between the pre-stored service attribute information and the message queue cluster and the service attribute information of the service server, wherein the target message queue cluster corresponding to the service attribute information is used as the target message queue cluster corresponding to the service server.
7. The method according to claim 6, wherein the correspondence between the service attribute information and the message queue cluster is pre-stored in a preset database;
the determining a message queue cluster corresponding to the target service attribute information from a plurality of pre-created message queue clusters according to a pre-stored correspondence between service attribute information and the message queue cluster and the service attribute information of the service server includes:
and inquiring a preset database which is stored with the corresponding relation between the service attribute information and the message queue cluster in advance by taking the service attribute information of the service server as an index so as to determine the message queue cluster corresponding to the service attribute information of the service server.
8. The method of claim 7, wherein the predetermined database is a Redis database.
9. The method according to any one of claims 6 to 8, wherein the establishing a subscription relationship between the service server and the target message queue cluster comprises:
sending a connection establishment request to the target message queue cluster, wherein the connection establishment request comprises an identifier of the service server, so that the target message queue cluster allocates a message queue for the service server;
receiving confirmation information returned by the target message queue cluster;
the obtaining a target service request for the service server from the target message queue cluster based on the subscription relationship includes:
and monitoring the message queue of the service server in the subscribed target message queue cluster, and acquiring a target service request aiming at the service server from the message queue of the service server in the target message queue cluster when receiving a notification message of the change of the message queue.
10. A service request distribution apparatus, applied to a management server, the apparatus comprising:
the service request acquisition module is used for acquiring a service request from a client;
a target message queue cluster determining module, configured to determine, from a plurality of message queue clusters created in advance, a message queue cluster corresponding to the service request as a target message queue cluster;
and the service request sending module is used for sending the service request to the target message queue cluster so that a service server determines a target message queue cluster corresponding to the service server in a plurality of pre-established message queue clusters, establishes a subscription relationship between the service server and the target message queue cluster, and acquires the target service request aiming at the service server from the target message queue cluster based on the subscription relationship.
11. The apparatus of claim 10, wherein the target message queue cluster determining module comprises:
a target service attribute information determining submodule, configured to determine target service attribute information of the service request;
a first target message queue cluster determining submodule, configured to determine, according to a correspondence between pre-stored service attribute information and a message queue cluster, a message queue cluster corresponding to the target service attribute information from a plurality of pre-created message queue clusters, as a target message queue cluster;
or
A target service server determining submodule, configured to determine a target service server of the service request;
and the second target message queue cluster determining submodule is used for determining a message queue cluster corresponding to the target service server from a plurality of pre-established message queue clusters according to the corresponding relationship between the pre-stored service server and the message queue cluster, and the message queue cluster is used as the target message queue cluster.
12. The apparatus according to claim 11, wherein the correspondence between the service attribute information and the message queue cluster is pre-stored in a preset database;
the first target message queue cluster determining submodule is specifically configured to query, with the target service attribute information as an index, a preset database in which a correspondence between the service attribute information and the message queue cluster is stored in advance, so as to determine the message queue cluster corresponding to the target service attribute information.
13. A service request receiving apparatus, applied to a service server, the apparatus comprising:
the target message queue cluster determining module is used for determining a target message queue cluster corresponding to the service server in a plurality of pre-established message queue clusters;
a subscription relationship establishing module, configured to establish a subscription relationship between the service server and a target message queue cluster;
a target service request obtaining module, configured to obtain a target service request for the service server from the target message queue cluster based on the subscription relationship; wherein, the target service request is: the management server acquires a service request from a client, determines a message queue cluster corresponding to the service request from a plurality of pre-established message queue clusters as a target message queue cluster, and sends the service request to the target message queue cluster.
14. The apparatus of claim 13, wherein the target message queue cluster determining module comprises:
a first target message queue cluster determining submodule, configured to determine, according to a correspondence between a pre-stored service server and a message queue cluster, a target message queue cluster corresponding to the service server from among the pre-created plurality of message queue clusters;
alternatively, the first and second electrodes may be,
and the second target message queue cluster determining submodule is used for determining a target message queue cluster corresponding to the service attribute information from a plurality of pre-established message queue clusters according to the corresponding relationship between the pre-stored service attribute information and the message queue cluster and the service attribute information of the service server, and using the target message queue cluster corresponding to the service attribute information as the target message queue cluster corresponding to the service server.
15. The apparatus according to claim 14, wherein the correspondence between the service attribute information and the message queue cluster is pre-stored in a preset database;
the second target message queue cluster determining submodule is specifically configured to query, with the service attribute information of the service server as an index, a preset database in which a correspondence between the service attribute information and the message queue cluster is stored in advance, so as to determine the message queue cluster corresponding to the service attribute information of the service server.
16. The apparatus according to any one of claims 13 to 15, wherein the subscription relationship establishing module includes:
a connection establishment request sending submodule, configured to send a connection establishment request to the target message queue cluster, where the connection establishment request includes an identifier of the service server, so that the target message queue cluster allocates a message queue for the service server;
the confirmation information receiving submodule is used for receiving the confirmation information returned by the target message queue cluster;
the target service request obtaining module is specifically configured to monitor a message queue of the service server in the subscribed target message queue cluster, and obtain a target service request for the service server from the message queue of the service server in the target message queue cluster when receiving a notification message of a change of the message queue.
17. A management server, characterized in that the management server comprises: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
the memory is used for storing a computer program;
the processor, when executing the program stored in the memory, implementing the method steps of any of claims 1-4.
18. A service server, characterized in that the service server comprises: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
the memory is used for storing a computer program;
the processor, when executing the program stored in the memory, implementing the method steps of any of claims 5-9.
19. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method of any one of claims 1 to 9.
20. A server cluster, the server cluster comprising: a management server and a plurality of service servers;
the management server is used for acquiring a service request from a client; determining a message queue cluster corresponding to the service request from a plurality of pre-established message queue clusters as a target message queue cluster; sending the service request to the target message queue cluster;
the service server is used for determining a target message queue cluster corresponding to the service server in a plurality of pre-established message queue clusters; establishing a subscription relation between the service server and a target message queue cluster; and acquiring a target service request aiming at the service server from the target message queue cluster based on the subscription relation.
CN201811482752.0A 2018-12-05 2018-12-05 Service request distribution method, service request receiving method, service request distribution device, service request receiving device and server cluster Active CN109660607B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811482752.0A CN109660607B (en) 2018-12-05 2018-12-05 Service request distribution method, service request receiving method, service request distribution device, service request receiving device and server cluster

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811482752.0A CN109660607B (en) 2018-12-05 2018-12-05 Service request distribution method, service request receiving method, service request distribution device, service request receiving device and server cluster

Publications (2)

Publication Number Publication Date
CN109660607A CN109660607A (en) 2019-04-19
CN109660607B true CN109660607B (en) 2021-08-27

Family

ID=66112719

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811482752.0A Active CN109660607B (en) 2018-12-05 2018-12-05 Service request distribution method, service request receiving method, service request distribution device, service request receiving device and server cluster

Country Status (1)

Country Link
CN (1) CN109660607B (en)

Families Citing this family (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110310034B (en) * 2019-06-28 2022-06-07 京东科技控股股份有限公司 Service arrangement and business flow processing method and device applied to SaaS
CN110740103A (en) * 2019-09-02 2020-01-31 深圳壹账通智能科技有限公司 Service request processing method and device, computer equipment and storage medium
CN112653625A (en) * 2019-10-10 2021-04-13 北京京东尚科信息技术有限公司 Message routing method and device
CN111193713A (en) * 2019-12-05 2020-05-22 贵阳语玩科技有限公司 System and method for managing global data of different countries by single server cluster
CN111193614A (en) * 2019-12-12 2020-05-22 贵阳语玩科技有限公司 Cross-regional server system and method for connecting different regional network environments in the world
CN111008087B (en) * 2019-12-25 2024-03-15 上海众源网络有限公司 Message processing method and device
CN111131082A (en) * 2019-12-25 2020-05-08 广东电科院能源技术有限责任公司 Charging facility data transmission dynamic control method and system
CN111045813B (en) * 2019-12-27 2024-01-02 京北方信息技术股份有限公司 Task distribution system and method
CN113055427B (en) * 2019-12-28 2022-12-23 浙江宇视科技有限公司 Service-based server cluster access method and device
CN113141383B (en) * 2020-01-18 2023-01-24 佛山市云米电器科技有限公司 Device information subscription method, client, server, system and storage medium
CN111491017B (en) * 2020-04-03 2023-05-26 广州市中海达测绘仪器有限公司 CORS reference station data distribution system, method and device
CN111586171B (en) * 2020-05-07 2023-05-30 广州虎牙信息科技有限公司 Server operation method and device, electronic equipment and storage medium
CN111580993A (en) * 2020-05-11 2020-08-25 广州虎牙信息科技有限公司 Data processing method and device, electronic equipment and storage medium
CN114338063B (en) * 2020-09-29 2023-11-10 中移物联网有限公司 Message queue system, service processing method and computer readable storage medium
CN112615901B (en) * 2020-11-26 2022-07-12 新华三大数据技术有限公司 Method for sending user request by client and storage system
CN112506682A (en) * 2021-01-29 2021-03-16 全时云商务服务股份有限公司 Method, device and computer readable storage medium for relieving abnormity of business server
CN112671933B (en) * 2021-02-23 2022-04-26 浙江中控技术股份有限公司 Data processing method and system
CN113422739B (en) * 2021-06-21 2022-09-06 上海哔哩哔哩科技有限公司 Data transmission method, sending end and data transmission system
CN113747192B (en) * 2021-11-03 2022-02-22 腾讯科技(深圳)有限公司 Live broadcast control method and device, electronic equipment and storage medium
CN114710311B (en) * 2022-02-11 2024-01-02 浙江高信技术股份有限公司 Multi-project message management method and system
CN114745757B (en) * 2022-04-22 2023-07-25 苏州浪潮智能科技有限公司 Cluster switching method, device, equipment and medium
CN115086333A (en) * 2022-04-25 2022-09-20 北京达佳互联信息技术有限公司 Service request distribution method, device and storage medium
CN117221324B (en) * 2023-11-09 2024-03-08 腾讯科技(深圳)有限公司 Cloud server creation task distribution method and device, electronic equipment and medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103927218A (en) * 2014-04-30 2014-07-16 广州唯品会网络技术有限公司 Event dispatching method and system
CN104079630A (en) * 2014-06-09 2014-10-01 中国建设银行股份有限公司 Business server side load balancing method, client side, server side and system
CN104219329A (en) * 2014-09-28 2014-12-17 浪潮软件集团有限公司 Method for deploying service through content distribution in cluster server
CN105607951A (en) * 2015-12-17 2016-05-25 北京奇虎科技有限公司 Method and device for processing data request and obtaining server information
CN106817408A (en) * 2016-12-27 2017-06-09 中国银联股份有限公司 A kind of distributed server cluster dispatching method and device
CN107580049A (en) * 2017-09-05 2018-01-12 同程网络科技股份有限公司 A kind of expansible efficient APP channels bag packing platform
CN107968836A (en) * 2017-12-06 2018-04-27 北京星河星云信息技术有限公司 A kind of task distribution method and device
CN108234565A (en) * 2016-12-21 2018-06-29 天脉聚源(北京)科技有限公司 A kind of method and system of server cluster processing task

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8606225B2 (en) * 2008-04-02 2013-12-10 At&T Mobility Ii Llc Intelligent real time billing for messaging
JP6256904B2 (en) * 2013-04-18 2018-01-10 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation Apparatus and method for distributing processing requests
CN104834722B (en) * 2015-05-12 2018-03-02 网宿科技股份有限公司 Content Management System based on CDN
CN107395729A (en) * 2017-07-27 2017-11-24 深圳乐信软件技术有限公司 A kind of consumption system of message queue, method and device
CN108712332B (en) * 2018-05-17 2020-07-07 华为技术有限公司 Communication method, system and device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103927218A (en) * 2014-04-30 2014-07-16 广州唯品会网络技术有限公司 Event dispatching method and system
CN104079630A (en) * 2014-06-09 2014-10-01 中国建设银行股份有限公司 Business server side load balancing method, client side, server side and system
CN104219329A (en) * 2014-09-28 2014-12-17 浪潮软件集团有限公司 Method for deploying service through content distribution in cluster server
CN105607951A (en) * 2015-12-17 2016-05-25 北京奇虎科技有限公司 Method and device for processing data request and obtaining server information
CN108234565A (en) * 2016-12-21 2018-06-29 天脉聚源(北京)科技有限公司 A kind of method and system of server cluster processing task
CN106817408A (en) * 2016-12-27 2017-06-09 中国银联股份有限公司 A kind of distributed server cluster dispatching method and device
CN107580049A (en) * 2017-09-05 2018-01-12 同程网络科技股份有限公司 A kind of expansible efficient APP channels bag packing platform
CN107968836A (en) * 2017-12-06 2018-04-27 北京星河星云信息技术有限公司 A kind of task distribution method and device

Also Published As

Publication number Publication date
CN109660607A (en) 2019-04-19

Similar Documents

Publication Publication Date Title
CN109660607B (en) Service request distribution method, service request receiving method, service request distribution device, service request receiving device and server cluster
US7558859B2 (en) Peer-to-peer auction based data distribution
CN109246229B (en) Method and device for distributing resource acquisition request
RU2509428C2 (en) Cluster server for instant messaging system and method for messaging between clusters
US20160255145A1 (en) Automated server replication
CN101136911B (en) Method to download files using P2P technique and P2P download system
WO2013078875A1 (en) Content management method, device and system
CN110519183B (en) Node speed limiting method and device, electronic equipment and storage medium
CN106230997B (en) Resource scheduling method and device
WO2021258753A1 (en) Service processing method and apparatus, and electronic device and storage medium
CN110430274A (en) A kind of document down loading method and system based on cloud storage
CN108933829A (en) A kind of load-balancing method and device
WO2012103920A1 (en) Distributed database
CA3030504A1 (en) Blockchain network and task scheduling method therefor
CN108156257B (en) Information pushing method and device
US20070265976A1 (en) License distribution in a packet data network
CN110909978A (en) Resource processing method, device, server and computer readable storage medium
WO2021073405A1 (en) Data distribution method, electronic device, and storage medium
JP2001202318A (en) Data distribution system
CN110995890B (en) Domain name request scheduling method and device
CN115329005A (en) Multi-cluster cooperation method, system, device and computer readable storage medium
CN111104376B (en) Resource file query method and device
CN110046040B (en) Distributed task processing method and system and storage medium
CN114612037A (en) Warehouse information management method and system
CN109460293B (en) Computing resource selection method under distributed computing environment in wireless cloud computing system

Legal Events

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