CN111327702B - Method and device for realizing server connection - Google Patents

Method and device for realizing server connection Download PDF

Info

Publication number
CN111327702B
CN111327702B CN202010123917.6A CN202010123917A CN111327702B CN 111327702 B CN111327702 B CN 111327702B CN 202010123917 A CN202010123917 A CN 202010123917A CN 111327702 B CN111327702 B CN 111327702B
Authority
CN
China
Prior art keywords
client
machine room
unit
region
server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010123917.6A
Other languages
Chinese (zh)
Other versions
CN111327702A (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.)
Jjworld Beijing Network Technology Co ltd
Original Assignee
Jjworld Beijing Network 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 Jjworld Beijing Network Technology Co ltd filed Critical Jjworld Beijing Network Technology Co ltd
Priority to CN202010123917.6A priority Critical patent/CN111327702B/en
Publication of CN111327702A publication Critical patent/CN111327702A/en
Application granted granted Critical
Publication of CN111327702B publication Critical patent/CN111327702B/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
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/101Server selection for load balancing based on network conditions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1021Server selection for load balancing based on client or server locations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions

Landscapes

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

Abstract

The embodiment of the application discloses a method and a device for realizing server connection. Therefore, the connection state of the client can be adjusted according to the state of the server through the real-time current machine room configuration information, so that the client can be connected to the optimal server, and the client and the server can be guaranteed to be kept in the optimal connection state.

Description

Method and device for realizing server connection
Technical Field
The application relates to the technical field of internet, in particular to a method and a device for realizing server connection.
Background
With the rapid development of internet technology, the number of clients is increasing and distributed in various regions. When the client is used, a connection needs to be established with the server, and in order to meet the requirement of a user for using the client, a machine room with a plurality of servers is generally established in different regions.
In the existing method for connecting a client to a server, it is generally determined according to a region where the client is located that a server in a machine room with a short distance is connected to the client, and after the client is connected to the server, the connection state is maintained until the client stops using the server. Because the connection relationship between the client and the server is relatively fixed, when the load of the server is too high or the server fails, the problems of disconnection and the like in the use of the client can be caused, and the normal use of the client is influenced.
Disclosure of Invention
In view of this, embodiments of the present application provide a method and an apparatus for implementing server connection, which can flexibly establish a connection between a client and a server according to a state of the server.
In order to solve the above problem, the technical solution provided by the embodiment of the present application is as follows:
in a first aspect, an embodiment of the present application provides a method for implementing server connection, where the method includes:
the method comprises the steps of obtaining a server connection request sent by a client, wherein the server connection request comprises a client region identifier and a client global identifier;
acquiring current machine room configuration information, wherein the machine room configuration information is updated in real time, the machine room configuration information comprises at least one region machine room corresponding to the client region identifier, the available state of each region machine room and the weight of a unit included in each region machine room, and each unit includes at least one server;
according to the client region identification, the client global identification and the current machine room configuration information, a first target machine set corresponding to the client is obtained through matching;
and sending the network address of the first target unit to the client so that the client sends a speed measurement signal to each server of the first target unit, obtains a first optimal server in the first target unit, and establishes connection with the first optimal server.
Optionally, the obtaining, by matching, the first target unit corresponding to the client according to the client region identifier, the client global identifier, and the current machine room configuration information includes:
matching to obtain a target machine room corresponding to the client according to the client region identifier, at least one region machine room corresponding to the client region identifier and the available state of each region machine room;
calculating the ratio of the value in the preset digit number in the global identification of the client to the preset total value;
determining proportion intervals respectively corresponding to the units in the target machine room according to the weight of the units in each region machine room;
and determining the unit corresponding to the ratio interval in which the ratio falls as a first target unit corresponding to the client.
Optionally, the method further includes:
adjusting any one or more of at least one region machine room corresponding to the client region identifier, the available state of each region machine room and the weight of a unit included in each region machine room;
adjusting the weight of each unit that region computer lab includes:
and adjusting the weight of the units in each region machine room according to the connection state reported by each unit.
Optionally, the method further includes:
when the machine room configuration information is updated, acquiring a client region identifier of a target client and a client global identifier of the target client; the target client is a client which establishes connection with a server in the machine set related to the update of the machine room configuration information;
matching to obtain a second target unit corresponding to the target client according to the client region identifier of the target client, the client global identifier of the target client and the current machine room configuration information;
and sending the network address of the second target unit to the target client so that the target client sends a speed measurement signal to each server of the second target unit, obtains a second optimal server in the second target unit, and establishes connection with the second optimal server.
Optionally, the method further includes:
judging whether the server connection request comprises a client global identifier or not;
if the server connection request does not comprise a client global identifier, sending re-request information comprising the client global identifier to the client so that the client re-sends the server connection request comprising the client global identifier;
and if the server connection request comprises a client global identifier, executing the current machine room configuration information acquisition and the subsequent steps.
In a second aspect, an embodiment of the present application provides an apparatus for implementing server connection, where the apparatus includes:
the system comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is used for acquiring a server connection request sent by a client, and the server connection request comprises a client region identifier and a client global identifier;
a second obtaining unit, configured to obtain current machine room configuration information, where the machine room configuration information is updated in real time, the machine room configuration information includes at least one region machine room corresponding to the client region identifier, an available state of each region machine room, and a weight of a unit included in each region machine room, and each unit includes at least one server;
the matching unit is used for matching to obtain a first target unit corresponding to the client according to the client region identifier, the client global identifier and the current machine room configuration information;
and the connection unit is used for sending the network address of the first target unit to the client so that the client sends a speed measurement signal to each server of the first target unit, obtains a first optimal server in the first target unit, and establishes connection with the first optimal server.
Optionally, the matching unit includes:
the matching subunit is used for matching to obtain a target machine room corresponding to the client according to the client region identifier, at least one region machine room corresponding to the client region identifier and the available state of each region machine room;
the calculating subunit is used for calculating the ratio of the numerical value in the preset digit number in the global identification of the client to the preset total numerical value;
the first determining subunit is configured to determine, according to the weight of the unit included in each region machine room, a proportion interval corresponding to each unit included in the target machine room;
and the second determining subunit is configured to determine the unit corresponding to the proportion interval in which the ratio falls as the first target unit corresponding to the client.
Optionally, the apparatus further comprises:
the adjusting unit is used for adjusting any one or more of at least one region machine room corresponding to the client region identifier, the available state of each region machine room and the weight of the unit included in each region machine room;
adjusting the weight of each unit that region computer lab includes:
and adjusting the weight of the units included in each region machine room according to the connection state reported by each unit.
Optionally, the apparatus further comprises:
the reconnection unit is used for acquiring a client region identifier of a target client and a client global identifier of the target client when the machine room configuration information is updated; the target client is a client which establishes connection with a server in the machine set related to the update of the machine room configuration information; matching to obtain a second target unit corresponding to the target client according to the client region identifier of the target client, the client global identifier of the target client and the current machine room configuration information; and sending the network address of the second target unit to the target client so that the target client sends a speed measurement signal to each server of the second target unit, obtains a second optimal server in the second target unit, and establishes connection with the second optimal server.
Optionally, the apparatus further comprises:
the judging unit is used for judging whether the server connection request comprises a client global identifier or not;
a sending unit, configured to send re-request information including the client global identifier to the client if the determination result of the determining unit is that the server connection request does not include the client global identifier, so that the client re-sends the server connection request including the client global identifier;
and the triggering unit is used for triggering the second acquiring unit to execute the acquisition of the current machine room configuration information if the judgment result of the judging unit is that the server connection request comprises a client global identifier.
Therefore, the embodiment of the application has the following beneficial effects:
in the embodiment of the application, a server connection request sent by a client is firstly obtained, and the current machine room configuration information is obtained, wherein the machine room configuration information is updated in real time; matching to obtain a first target unit corresponding to the client according to the client region identifier, the client global identifier and the current machine room configuration information; and finally, sending the network address of the first target unit to the client so that the client sends a speed measurement signal to each server of the first target unit, obtains a first optimal server in the first target unit, and establishes connection with the first optimal server. Therefore, the first target unit can be determined through the server connection request and the machine room configuration information of the client, the speed measurement signal is sent through the client, the first optimal server is determined and connected, the client can be connected to the optimal server in real time through the real-time machine room configuration information, and the client is guaranteed to be used optimally.
Drawings
Fig. 1 is a schematic frame diagram of an exemplary application scenario of a method for implementing server connection according to an embodiment of the present application;
fig. 2 is a flowchart of a method for implementing server connection according to an embodiment of the present disclosure;
fig. 3 is a flowchart of another method for implementing server connection according to an embodiment of the present disclosure;
fig. 4 is a flowchart of another method for implementing server connection according to an embodiment of the present disclosure;
fig. 5 is a flowchart of another method for implementing server connection according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of an apparatus for implementing server connection according to an embodiment of the present disclosure.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, embodiments accompanying the drawings are described in detail below.
In order to facilitate understanding and explaining the technical solutions provided by the embodiments of the present application, the following description will first describe the background art of the present application.
The inventor finds out in the research of the existing connection process of the client and the server that: the existing connection relationship between the client and the server is relatively fixed, and when the client and the server are connected, the client often selects the server with a relatively short distance to connect. However, the client distribution is wide, and the client distribution is not uniform in each area. The adoption of the fixed connection mode can cause the load of part of servers to be overhigh, and after the client establishes the connection relation with the server, the connection state of the client and the server can not be dynamically adjusted according to the state of the server, so that the problems of disconnection or network delay and the like can be caused to the client connected with the server when the load of the server is overhigh or the server fails, and the normal use of a user is influenced.
Based on this, an embodiment of the present application provides a method for implementing server connection, where the method includes: acquiring a server connection request sent by a client, wherein the server connection request comprises a client region identifier and a client global identifier; the method comprises the steps that current machine room configuration information is obtained, the machine room configuration information is updated in real time, the machine room configuration information comprises at least one region machine room corresponding to a client region identification, the available state of each region machine room and the weight of a machine set included in each region machine room, and each machine set comprises at least one server; according to the client region identification, the client global identification and the current machine room configuration information, a first target machine set corresponding to the client is obtained through matching; and sending the network address of the first target unit to the client so that the client sends a speed measurement signal to each server of the first target unit, obtains a first optimal server in the first target unit, and establishes connection with the first optimal server. The first target unit corresponding to the client is obtained according to the server connection request sent by the client and the current machine room configuration information in a matching mode, and then the client is used for measuring the speed of each server of the first target unit, so that the client can be connected with the current optimal server, the dynamic adjustment of the connection between the client and the server can be realized, the server connected with the client is the optimal server in the current state, and the connection state between the client and the server is guaranteed to be optimal.
In order to facilitate understanding of the method for implementing server connection provided in the embodiment of the present application, an application scenario for implementing server connection provided in the embodiment of the present application is described below with reference to fig. 1. Referring to fig. 1, fig. 1 is a schematic diagram of a framework of an exemplary application scenario of a method for implementing server connection provided in the embodiment of the present application, where the method for implementing server connection provided in the embodiment of the present application may be applied to a background management server 101.
In actual application, the background management server 101 obtains a server connection request and current machine room configuration information sent by the client 103. The server connection request may include a client region identifier and a client global identifier, and the machine room configuration information is updated in real time. The background management server 101 matches the client region identifier, the client global identifier and the current machine room configuration information in the machine room 102 to obtain a first target machine set corresponding to the client. The background management server 101 sends the network address of the first target unit to the client 103, so that the client 103 sends a speed measurement signal to each server in the first target unit, obtains a first optimal server in the first target unit, and establishes a connection with the first optimal server.
It should be noted that the backend management server 101 may be independent from the client 103 and the computer room 102, and the backend management server 101 may be a server other than the server of the computer room 102. It is noted that client 103 may be any user device now existing, developing or developed in the future that is capable of interacting with each other through any form of wired and/or wireless connection (e.g., Wi-Fi, LAN, cellular, coaxial, etc.), including but not limited to: smart wearable devices, smart phones, non-smart phones, tablets, laptop personal computers, desktop personal computers, minicomputers, midrange computers, mainframe computers, and the like, either now in existence, under development, or developed in the future. The embodiments of the present application are not limited in any way in this respect. It should be further noted that the computer room 102 in the embodiment of the present application is a device including a plurality of units, each of which includes a plurality of servers, and may be an example of an existing device, a device under development, or a device developed in the future that is capable of performing the above operations. The embodiments of the present application are not limited in any way in this respect.
Those skilled in the art will appreciate that the block diagram shown in fig. 1 is only one example in which embodiments of the present application may be implemented. The scope of applicability of the embodiments of the present application is not limited in any way by this framework.
In order to facilitate understanding of the technical solutions provided by the embodiments of the present application, a method for implementing server connection provided by the embodiments of the present application will be described below with reference to the accompanying drawings.
Referring to fig. 2, which is a flowchart of a method for implementing server connection according to an embodiment of the present application, as shown in fig. 2, the method may include S201 to S204:
s201: and acquiring a server connection request sent by the client, wherein the server connection request comprises a client region identifier and a client global identifier.
It can be understood that, when a client needs to connect to a server, the client first sends a server connection request to the backend management server. The background management server may obtain a server connection request sent by the client, where the server connection request may include a client region identifier and a client global identifier. In this embodiment, a specific manner in which the client sends the server connection request is not limited, for example, the client may send the server connection request to the background management server in a wireless transmission manner.
The client region identifier may be identification information related to a region where the client is currently located, and the client region identifier may be changed according to a location where the client is located, and generate a corresponding client region identifier according to current location information. In a possible implementation manner, the region identifier may be divided according to a city-level region, such as beijing, shanghai, and the like, or according to a main location where the server is distributed, such as north china, east china, and the like.
In this embodiment of the present application, the client global identifier may be an identifier uniquely corresponding to each client, and a generation manner of the client global identifier is not limited in this embodiment of the present application.
In a possible implementation manner, after obtaining the server connection request sent by the client, the method may further include:
judging whether the server connection request comprises a client global identifier or not; if the server connection request does not comprise the client global identification, re-request information comprising the client global identification is sent to the client so that the client re-sends the server connection request comprising the client global identification; if the server connection request includes the client global identifier, S202 is executed to obtain the current machine room configuration information and the subsequent steps.
It can be understood that, part of the clients themselves do not have the client global identifier, and the sent server connection request does not have the client global identifier, and at this time, if it is determined that the server connection request does not include the client global identifier, the re-request information with the client global identifier is sent to the client. The client global identifier may be allocated to the client by the background management server, and the client may send a server connection request with the client global identifier to the background management server according to the client global identifier in the re-request information.
S202: the method comprises the steps of obtaining current machine room configuration information, wherein the machine room configuration information is updated in real time, the machine room configuration information comprises at least one region machine room corresponding to a client region identification, the available state of each region machine room and the weight of a machine set included in each region machine room, and each machine set includes at least one server.
In a possible implementation manner, each machine room includes at least two or more machine groups, and each machine group includes at least two or more servers.
The machine room configuration information may include at least one region machine room corresponding to the client region identifier, an available state of each region machine room, and a weight of a unit included in each region machine room.
In the embodiment of the application, the division mode of the region machine room is not limited, and in one possible division mode, the machine rooms in a larger region can be divided, for example, the region machine room can include a north China machine room, a east China machine room, a south China machine room and the like. It should be noted that, the region machine room corresponding to the client region identifier is determined, and the corresponding region machine room can be searched in all the region machine room lists according to the client region identifier. In a corresponding manner, the region range included in the region machine room may include a region range in which the client region identifier is located, for example, when the region corresponding to the client region identifier is beijing, the region machine room corresponding to the client region identifier may be a north china machine room. In another corresponding manner, the region range included in the region machine room may be a region range in which the region identifier of the adjacent client is located, for example, when the region corresponding to the region identifier of the client is beijing city, the region machine room corresponding to the region identifier of the client may be a china east machine room. In the embodiment of the application, the number of the region machine rooms corresponding to the client region identifier is not limited, and may be at least one. It can be understood that, when a plurality of region machine rooms corresponding to the client region identifiers are provided, each region machine room may have a priority relationship, and a priority may be set for each region machine room according to a degree that a region range included in the region machine room is adjacent to a region range where the client region identifier is located. For example, when the client region identifier indicates that the client is located in beijing, the region machine room corresponding to the client region identifier may be a north china machine room whose region range includes beijing, a east china machine room whose region range is adjacent to beijing, and a south china machine room. The priorities of the three regional machine rooms can be determined according to the degree that the regional scope is adjacent to Beijing city, wherein the North China machine room has the highest priority, the east China machine room has the second highest priority, and the south China machine room has the lowest priority.
The machine room configuration information further includes available states of the region machine rooms, and it can be understood that when the region machine room corresponding to the client region identifier is determined, the available state of the region machine room corresponding to the client region identifier can be determined, that is, whether an available condition is met or not can be determined, and if a certain corresponding region machine room is unavailable, the priority level of the region machine room of the next priority can be adjusted according to the priority. For example, when the north china computer lab is unavailable due to a fault, the available state of the north china computer lab is the unavailable state, and the priority of the east china computer lab and the south china computer lab in the region computer lab corresponding to the client region identifier is increased, where the priority of the east china computer lab is the highest. It can be understood that the machine room can be adjusted according to the operating state of the machine room, when the machine room is in a fault or needs maintenance, the machine room can be wholly closed or partially closed, and the available state of the machine room is wholly unavailable or partially unavailable.
The weight of the unit of each region machine room may refer to a ratio of the number of the clients that can be connected to the unit in the region machine room to the total number of the clients that can be connected to the region machine room. For example, if the total number of clients that can be connected by all the groups in one computer room is 10000, there are three groups in total, if the number of clients that can be connected by the first group is 3000, the weight of the first group is 30%, if the number of clients that can be connected by the second group is 4000, the weight of the second group is 40%, and if the number of clients that can be connected by the third group is 3000, the weight of the second group is 30%.
It should be noted that the machine room configuration information is updated in real time, and the real-time updating mode is not limited in the embodiment of the present application, and the new machine room configuration information may be acquired at a preset time interval, or various parameters included in the machine room configuration information may be monitored, and when a change occurs, the new machine room configuration information is acquired.
When the configuration information of the machine room needs to be updated and adjusted, the method may further include:
adjusting any one or more of at least one region machine room corresponding to the client region identification, the available state of each region machine room and the weight of the unit included in each region machine room;
wherein, the weight of the unit that each region computer lab of adjustment includes: and adjusting the weight of the units in each region machine room according to the connection state reported by each unit.
It can be understood that when the configuration of the machine room is changed, the configuration information of the machine room needs to be changed, and any one or more of at least one region machine room corresponding to the client region identifier, the available state of each region machine room, and the weight of the unit included in each region machine room can be adjusted. For example, when a new region machine room starts to be used, the number of the region machine rooms corresponding to the client region identifier may be adjusted; when the regional machine room fails and stops using, the available state of the regional machine room can be adjusted. For example, when one unit in the regional machine rooms is disconnected, the total number of clients which can be connected in the regional machine rooms correspondingly decreases, and the weights of the rest of units which are normally connected correspondingly increases.
S203: and matching to obtain a first target unit corresponding to the client according to the client region identifier, the client global identifier and the current machine room configuration information.
It should be noted that the first target unit corresponding to the client may be obtained by matching according to the client region identifier, the client global identifier, and the current machine room configuration information, where a server in the first target unit is a server more suitable for being connected with the client. In the embodiment of the application, the method for matching the first target unit and the number of the first target units are not limited, and the first target unit can be matched by firstly matching the regional machine room and then matching the first target unit. In a possible implementation manner, a region machine room corresponding to the client region identifier may be first obtained by matching, and then a first target unit is obtained by matching in the region machine room; or, a primary regional machine room and a standby regional machine room are obtained by matching in the regional machine room corresponding to the client regional identifier, and the primary first target unit and the standby first target unit are obtained by matching the first target unit in the primary regional machine room and the standby regional machine room respectively.
In this embodiment of the present application, referring to fig. 3, which is a flowchart of another method for implementing server connection provided in this embodiment of the present application, as shown in fig. 3, S203 may specifically include S2031 to S2034:
s2031: and matching to obtain a target machine room corresponding to the client according to the client region identifier, at least one region machine room corresponding to the client region identifier and the available state of each region machine room.
It can be understood that, according to at least one region machine room corresponding to the region identifier of the client and the available state of each region machine room, a target machine room corresponding to the client may be obtained.
S2032: and calculating the ratio of the numerical value in the preset digit number in the global identification of the client to the preset total numerical value.
It should be noted that the global identifier of the client has a value within a preset number of bits, which can be used for comparing with a preset total number to obtain a corresponding ratio. For example, when the last 4 bits of the global id of the client are 2000 and the preset total number is 10000, the corresponding ratio is 20%. The specific number of the preset digits in the client global identifier is not limited in the embodiment of the application, and the preset digits can be set according to the type of the client global identifier, for example, the last three digits in the client global identifier or the first four digits.
S2033: and determining the proportion intervals corresponding to the units in the target machine room according to the weight of the units in each regional machine room.
It should be noted that, the proportion intervals corresponding to each unit included in the target machine room may be determined according to the weight of the unit included in the regional machine room, and the proportion interval corresponding to the unit may be an interval between the highest proportion of the previous unit and the sum of the highest proportion of the previous unit and the weight of the unit. For example, if the total number of clients that can be connected by all the units in a machine room is 10000, there are three units in total, if the number of clients that can be connected by the first unit is 4000, the weight of the first unit is 40%, and the corresponding proportion interval is (0, 40% ], i.e., greater than 0 and less than or equal to 40%, if the number of clients that can be connected by the second unit is 3000, the weight of the second unit is 30%, the corresponding proportion interval is (40%, 70% ], i.e., greater than 40% and less than or equal to 70%, if the number of clients that can be connected by the third unit is 3000, the weight of the second unit is 30%, and the corresponding proportion interval is (70, 100%), i.e., greater than 70% and less than or equal to 100%.
S2034: and determining the unit corresponding to the ratio interval in which the ratio falls as a first target unit corresponding to the client.
And judging which unit the ratio is in according to the ratio obtained by S2032 and the ratio interval of the unit obtained by S2033, and determining the unit corresponding to the ratio interval in which the ratio falls as a first target unit corresponding to the client. For example, if the ratio is 20%, the ratio intervals are (0, 40% >, (40%, 70% >) and (70%, 100% >), respectively, the ratio is in the ratio interval of (0, 40% >), and the unit corresponding to the ratio interval of (0, 40% >) is the first target unit corresponding to the client.
S204: and sending the network address of the first target unit to the client so that the client sends a speed measurement signal to each server of the first target unit, obtains a first optimal server in the first target unit, and establishes connection with the first optimal server.
The background management server may send the network address of the first target unit to the client, and it can be understood that, since the first target unit has a plurality of servers, the client may send a speed measurement signal to each server to detect the performance of each server, and the server with the best speed measurement result may be determined as the first optimal server, and the first optimal server is obtained to establish a connection with the first optimal server.
In the embodiment of the application, a specific mode for sending the speed measurement signal is not limited, and in a possible implementation mode, the speed measurement signal can be sent to the server in the first target unit at the same time, and a feedback result is obtained; the speed measurement signals can also be respectively sent to the servers in the first target unit, and the feedback results corresponding to different servers can be respectively obtained.
In a possible implementation manner of the embodiment of the present application, an embodiment of the present application further provides another implementation manner of a method for implementing server connection, where in the implementation manner, as shown in fig. 4, fig. 4 is a flowchart of another method for implementing server connection provided in the embodiment of the present application; the method for realizing server connection comprises S205-S207, in addition to the above S201-S204:
s205: when the machine room configuration information is updated, acquiring a client region identifier of a target client and a client global identifier of the target client; the target client is a client which establishes connection with a server in the machine set related to the update of the machine room configuration information.
It can be understood that when the machine room configuration information is updated, the client that has established a connection with the server of the relevant machine group in the machine room may be affected, so that the client region identifier of the target client and the client global identifier of the target client need to be obtained. The client region identifier and the client global identifier of the target client may be the same as or different from the client region identifier and the client global identifier before the client establishes a connection with the first optimal server, and embodiments of the present application are not limited herein.
S206: and matching to obtain a second target unit corresponding to the target client according to the client region identifier of the target client, the client global identifier of the target client and the current machine room configuration information.
In this embodiment of the present application, referring to fig. 5, which is a flowchart of another method for implementing server connection provided in this embodiment of the present application, as shown in fig. 5, S206 may specifically include S2061 to S2064:
s2061: and matching to obtain the target machine room corresponding to the target client according to the client region identification of the target client, at least one region machine room corresponding to the client region identification of the target client and the available state of each region machine room.
It can be understood that, according to at least one region machine room corresponding to the client region identifier and the available state of each region machine room, a target machine room corresponding to the target client may be obtained.
S2062: and calculating the ratio of the numerical value in the preset digit number in the global client identifier of the target client to the preset total numerical value.
It should be noted that the global identifier of the client has a numerical value with a preset number of bits, which can be used for comparing with a preset total number to obtain a corresponding ratio.
S2063: and determining the proportion intervals respectively corresponding to the units in the target machine room corresponding to the target client according to the weight of the units in each regional machine room.
It should be noted that, the proportion intervals respectively corresponding to each unit included in the target machine room corresponding to the target client may be determined according to the weight of the unit included in the regional machine room, and the proportion interval corresponding to the unit may be an interval between the highest proportion of the last unit and the sum of the highest proportion of the last unit and the weight of the unit.
S2064: and determining the unit corresponding to the ratio interval in which the ratio falls as a second target unit corresponding to the target client.
And judging the ratio in the ratio interval corresponding to the set according to the ratio obtained in the step S2062 and the ratio interval of the set obtained in the step S2063, and determining the set corresponding to the ratio interval in which the ratio falls as a second target set corresponding to the client.
It is understood that the second target unit may be the same unit as the first target unit or may be a different unit.
S207: and sending the network address of the second target unit to the target client so that the target client sends a speed measurement signal to each server of the second target unit, acquires a second optimal server in the second target unit, and establishes connection with the second optimal server.
It should be noted that, before the target client establishes a connection with the second optimal server, the target client needs to disconnect from the server that has already established a connection relationship, and then establish a connection with the second optimal server.
Therefore, according to the embodiment of the application, the first target unit can be determined through the server connection request and the machine room configuration information of the client, the speed measurement signal is sent through the client, the first optimal server is determined and connected, the client can be connected to the optimal server in real time through the real-time machine room configuration information, and the client can be guaranteed to be used optimally. In addition, the machine room configuration information can be adjusted in real time according to the actual service conditions of the server, the machine set and the machine room, and when the machine room configuration information is updated, the client can be connected to the optimal server again, so that the dynamic management server and the connection between the dynamic management client and the server are realized.
The embodiment of the application introduces a device for realizing server connection. Referring to fig. 6, this figure is a schematic structural diagram of an apparatus for implementing server connection according to an embodiment of the present application.
A first obtaining unit 301, configured to obtain a server connection request sent by a client, where the server connection request includes a client region identifier and a client global identifier;
a second obtaining unit 302, configured to obtain current machine room configuration information, where the machine room configuration information is updated in real time, the machine room configuration information includes at least one region machine room corresponding to the client region identifier, an available state of each region machine room, and a weight of a unit included in each region machine room, and each unit includes at least one server;
a matching unit 303, configured to obtain, by matching, a first target unit corresponding to the client according to the client region identifier, the client global identifier, and the current machine room configuration information;
a connection unit 304, configured to send the network address of the first target unit to the client, so that the client sends a velocity measurement signal to each server of the first target unit, obtains a first optimal server in the first target unit, and establishes a connection with the first optimal server.
Optionally, the matching unit 302 includes:
the matching subunit is used for matching to obtain a target machine room corresponding to the client according to the client region identifier, at least one region machine room corresponding to the client region identifier and the available state of each region machine room;
the calculating subunit is used for calculating the ratio of the numerical value in the preset digit number in the global identification of the client to the preset total numerical value;
the first determining subunit is configured to determine, according to the weight of the unit included in each region machine room, a proportion interval corresponding to each unit included in the target machine room;
and the second determining subunit is configured to determine the unit corresponding to the proportion interval in which the ratio falls as the first target unit corresponding to the client.
Optionally, the apparatus further comprises:
the adjusting unit is used for adjusting any one or more of at least one region machine room corresponding to the client region identifier, the available state of each region machine room and the weight of the unit included in each region machine room;
adjusting the weight of each unit that region computer lab includes:
and adjusting the weight of the units included in each region machine room according to the connection state reported by each unit.
Optionally, the apparatus further comprises:
the reconnection unit is used for acquiring a client region identifier of a target client and a client global identifier of the target client when the machine room configuration information is updated; the target client is a client which establishes connection with a server in the machine set related to the update of the machine room configuration information; matching to obtain a second target unit corresponding to the target client according to the client region identifier of the target client, the client global identifier of the target client and the current machine room configuration information; and sending the network address of the second target unit to the target client so that the target client sends a speed measurement signal to each server of the second target unit, obtains a second optimal server in the second target unit, and establishes connection with the second optimal server.
Optionally, the apparatus further comprises:
the judging unit is used for judging whether the server connection request comprises a client global identifier or not;
a sending unit, configured to send re-request information including the client global identifier to the client if the determination result of the determining unit is that the server connection request does not include the client global identifier, so that the client re-sends the server connection request including the client global identifier;
and the triggering unit is used for triggering the second acquiring unit to execute the acquisition of the current machine room configuration information if the judgment result of the judging unit is that the server connection request comprises a client global identifier.
In the embodiment of the application, a server connection request sent by a client is firstly obtained, and the current machine room configuration information is obtained, wherein the machine room configuration information is updated in real time; matching to obtain a first target unit corresponding to the client according to the client region identifier, the client global identifier and the current machine room configuration information; and finally, sending the network address of the first target unit to the client so that the client sends a speed measurement signal to each server of the first target unit, obtains a first optimal server in the first target unit, and establishes connection with the first optimal server. Therefore, the first target unit can be determined through the server connection request and the machine room configuration information of the client, the speed measurement signal is sent through the client, the first optimal server is determined and connected, the client can be connected to the optimal server in real time through the real-time machine room configuration information, and the client is guaranteed to be used optimally.
It should be noted that, in the present specification, the embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the system or the device disclosed by the embodiment, the description is simple because the system or the device corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description.
It should be understood that in the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" for describing an association relationship of associated objects, indicating that there may be three relationships, e.g., "a and/or B" may indicate: only A, only B and both A and B are present, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of single item(s) or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
It is further 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.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method for enabling server connectivity, the method comprising:
the method comprises the steps of obtaining a server connection request sent by a client, wherein the server connection request comprises a client region identifier and a client global identifier;
acquiring current machine room configuration information, wherein the machine room configuration information is updated in real time, the machine room configuration information comprises at least one region machine room corresponding to the client region identifier, the available state of each region machine room and the weight of a unit included in each region machine room, and each unit includes at least one server;
according to the client region identification, the client global identification and the current machine room configuration information, a first target machine set corresponding to the client is obtained through matching;
sending the network address of the first target unit to the client, so that the client sends a speed measurement signal to each server of the first target unit, obtains a first optimal server in the first target unit, and establishes connection with the first optimal server;
the connection between the client and the first optimal server in the first target unit is dynamically adjusted, and the server connected with the client is automatically kept to be the optimal server in the current state in real time.
2. The method of claim 1, wherein the obtaining, by matching, the first target group corresponding to the client according to the client region identifier, the client global identifier, and the current machine room configuration information includes:
matching to obtain a target machine room corresponding to the client according to the client region identifier, at least one region machine room corresponding to the client region identifier and the available state of each region machine room;
calculating the ratio of the numerical value in the preset digit number in the global identification of the client to the preset total numerical value;
determining proportion intervals respectively corresponding to the units in the target machine room according to the weight of the units in each region machine room;
and determining the unit corresponding to the ratio interval in which the ratio falls as a first target unit corresponding to the client.
3. The method of claim 1, further comprising:
adjusting any one or more of at least one region machine room corresponding to the client region identifier, the available state of each region machine room and the weight of a unit included in each region machine room;
adjusting the weight of each unit that region computer lab includes:
and adjusting the weight of the units included in each region machine room according to the connection state reported by each unit.
4. The method according to any one of claims 1-3, further comprising:
when the machine room configuration information is updated, acquiring a client region identifier of a target client and a client global identifier of the target client; the target client is a client which establishes connection with a server in the machine set related to the update of the machine room configuration information;
matching to obtain a second target unit corresponding to the target client according to the client region identifier of the target client, the client global identifier of the target client and the current machine room configuration information;
and sending the network address of the second target unit to the target client so that the target client sends a speed measurement signal to each server of the second target unit, obtains a second optimal server in the second target unit, and establishes connection with the second optimal server.
5. The method of claim 1, further comprising:
judging whether the server connection request comprises a client global identifier or not;
if the server connection request does not comprise a client global identifier, sending re-request information comprising the client global identifier to the client so that the client re-sends the server connection request comprising the client global identifier;
and if the server connection request comprises a client global identifier, executing the current machine room configuration information acquisition and the subsequent steps.
6. An apparatus for enabling server connectivity, the apparatus comprising:
the system comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is used for acquiring a server connection request sent by a client, and the server connection request comprises a client region identifier and a client global identifier;
a second obtaining unit, configured to obtain current machine room configuration information, where the machine room configuration information is updated in real time, the machine room configuration information includes at least one region machine room corresponding to the client region identifier, an available state of each region machine room, and a weight of a unit included in each region machine room, and each unit includes at least one server;
the matching unit is used for matching to obtain a first target unit corresponding to the client according to the client region identifier, the client global identifier and the current machine room configuration information;
the connection unit is used for sending the network address of the first target unit to the client so that the client sends a speed measurement signal to each server of the first target unit, obtains a first optimal server in the first target unit, and establishes connection with the first optimal server;
and the reconnection unit is used for dynamically adjusting the connection between the client and the first optimal server in the first target unit, and automatically keeping the server connected with the client as the optimal server in the current state in real time.
7. The apparatus of claim 6, wherein the matching unit comprises:
the matching subunit is used for matching to obtain a target machine room corresponding to the client according to the client region identifier, at least one region machine room corresponding to the client region identifier and the available state of each region machine room;
the calculating subunit is used for calculating the ratio of the numerical value in the preset digit number in the global identification of the client to the preset total numerical value;
the first determining subunit is configured to determine, according to the weight of the unit included in each region machine room, a proportion interval corresponding to each unit included in the target machine room;
and the second determining subunit is configured to determine the unit corresponding to the proportion interval in which the ratio falls as the first target unit corresponding to the client.
8. The apparatus of claim 6, further comprising:
the adjusting unit is used for adjusting any one or more of at least one region machine room corresponding to the client region identifier, the available state of each region machine room and the weight of the unit included in each region machine room;
adjusting the weight of each unit that region computer lab includes:
and adjusting the weight of the units included in each region machine room according to the connection state reported by each unit.
9. The device according to any one of claims 6 to 8, applied to a reconnection unit, wherein the reconnection unit is configured to, when the machine room configuration information is updated, obtain a client region identifier of a target client and a client global identifier of the target client; the target client is a client which establishes connection with a server in the machine set related to the update of the machine room configuration information; matching to obtain a second target unit corresponding to the target client according to the client region identifier of the target client, the client global identifier of the target client and the current machine room configuration information; and sending the network address of the second target unit to the target client so that the target client sends a speed measurement signal to each server of the second target unit, obtains a second optimal server in the second target unit, and establishes connection with the second optimal server.
10. The apparatus of claim 6, further comprising:
the judging unit is used for judging whether the server connection request comprises a client global identifier or not;
a sending unit, configured to send re-request information including the client global identifier to the client if the determination result of the determining unit is that the server connection request does not include the client global identifier, so that the client re-sends the server connection request including the client global identifier;
and the triggering unit is used for triggering the second acquiring unit to execute the acquisition of the current machine room configuration information if the judgment result of the judging unit is that the server connection request comprises a client global identifier.
CN202010123917.6A 2020-02-27 2020-02-27 Method and device for realizing server connection Active CN111327702B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010123917.6A CN111327702B (en) 2020-02-27 2020-02-27 Method and device for realizing server connection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010123917.6A CN111327702B (en) 2020-02-27 2020-02-27 Method and device for realizing server connection

Publications (2)

Publication Number Publication Date
CN111327702A CN111327702A (en) 2020-06-23
CN111327702B true CN111327702B (en) 2022-05-10

Family

ID=71171161

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010123917.6A Active CN111327702B (en) 2020-02-27 2020-02-27 Method and device for realizing server connection

Country Status (1)

Country Link
CN (1) CN111327702B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103841136A (en) * 2012-11-22 2014-06-04 腾讯科技(深圳)有限公司 Acceleration method and system of application program
EP2785136A1 (en) * 2013-03-27 2014-10-01 Fujitsu Limited Relieving Congestion in Wireless Local Area Networks
CN106790608A (en) * 2016-12-29 2017-05-31 北京奇艺世纪科技有限公司 A kind of system of selection of server and device
CN110113446A (en) * 2019-05-23 2019-08-09 竞技世界(成都)网络技术有限公司 A kind of client addressing method, apparatus and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103841136A (en) * 2012-11-22 2014-06-04 腾讯科技(深圳)有限公司 Acceleration method and system of application program
EP2785136A1 (en) * 2013-03-27 2014-10-01 Fujitsu Limited Relieving Congestion in Wireless Local Area Networks
CN106790608A (en) * 2016-12-29 2017-05-31 北京奇艺世纪科技有限公司 A kind of system of selection of server and device
CN110113446A (en) * 2019-05-23 2019-08-09 竞技世界(成都)网络技术有限公司 A kind of client addressing method, apparatus and system

Also Published As

Publication number Publication date
CN111327702A (en) 2020-06-23

Similar Documents

Publication Publication Date Title
CN101677324B (en) Business management method, terminal, network system and related equipment
US6898635B2 (en) Mobile communication system and method of selecting server in mobile communication system
CN109104483B (en) Micro-service dynamic load balancing method and device based on event notification
WO2020019472A1 (en) Rating method for service node, domain name system (dns) scheduling method and server
CN109921925B (en) Dial testing method and device
CN111327647B (en) Method and device for providing service to outside by container and electronic equipment
CN109417492B (en) Network function NF management method and NF management equipment
CN110519183B (en) Node speed limiting method and device, electronic equipment and storage medium
WO2021169294A1 (en) Application recognition model updating method and apparatus, and storage medium
CN103227754A (en) Dynamic load balancing method of high-availability cluster system, and node equipment
CN111083181A (en) Equipment scheduling method, gateway and system for large-scale access to Internet of things
CN111949404A (en) Method and device for adjusting server load and related equipment
CN111327702B (en) Method and device for realizing server connection
CN112910743B (en) Block chain performance detection system
CN101867580A (en) Method for allocating network flow and device
CN106790610B (en) Cloud system message distribution method, device and system
CN113992685B (en) Service controller determining method, system and device
CN116546028A (en) Service request processing method and device, storage medium and electronic equipment
CN110213778B (en) Method and device for intelligently pairing main network element and standby network element
CN110543509A (en) Monitoring system, method and device for user access data and electronic equipment
AU2019239150B2 (en) Partitioning data in a clustered database environment
CN111901174B (en) Service state notification method, related device and storage medium
CN114124797A (en) Server routing method and device, electronic equipment and storage medium
CN109661005B (en) Load sharing adjustment method and device of local access controller
CN109040309B (en) Load balancing method based on XMPP communication processing server

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