Movatterモバイル変換


[0]ホーム

URL:


CN109933432A - Method and apparatus for sending data - Google Patents

Method and apparatus for sending data
Download PDF

Info

Publication number
CN109933432A
CN109933432ACN201910208991.5ACN201910208991ACN109933432ACN 109933432 ACN109933432 ACN 109933432ACN 201910208991 ACN201910208991 ACN 201910208991ACN 109933432 ACN109933432 ACN 109933432A
Authority
CN
China
Prior art keywords
server
state
target
group
request information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910208991.5A
Other languages
Chinese (zh)
Inventor
刘传奇
杨光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Baidu Netcom Science and Technology Co LtdfiledCriticalBeijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201910208991.5ApriorityCriticalpatent/CN109933432A/en
Publication of CN109933432ApublicationCriticalpatent/CN109933432A/en
Pendinglegal-statusCriticalCurrent

Links

Landscapes

Abstract

Embodiment of the disclosure discloses the method and apparatus for sending data.One specific embodiment of this method includes: the solicited message for receiving the client of communication connection and sending;In response to determining in first server group there are the first server that at least one operating status is first state, destination server is determined from least one first server;Solicited message is sent to destination server.The embodiment helps to realize will be transmitted to the destination server of specified operating status from the solicited message of client.

Description

Translated fromChinese
用于发送数据的方法和装置Method and apparatus for sending data

技术领域technical field

本公开的实施例涉及计算机技术领域,具体涉及用于发送数据的方法和装置。Embodiments of the present disclosure relate to the field of computer technology, and in particular, to a method and apparatus for sending data.

背景技术Background technique

负载均衡器(Load Balancer)通常是指将请求信息分散到一个服务器集群中的可用服务器上去的设备。负载均衡器通常建立在现有网络结构之上,其作用通常为:增加网络数据吞吐量、加强网络数据处理能力、提高网络的灵活性和可用性。A load balancer usually refers to a device that distributes request information to the available servers in a server cluster. The load balancer is usually built on the existing network structure, and its function is usually to increase the network data throughput, strengthen the network data processing capacity, and improve the flexibility and availability of the network.

相关技术中,负载均衡器需要将来自于客户端的请求信息转发至目标服务器。In the related art, the load balancer needs to forward the request information from the client to the target server.

发明内容SUMMARY OF THE INVENTION

本公开的实施例提出了用于发送数据的方法和装置。Embodiments of the present disclosure propose methods and apparatuses for transmitting data.

第一方面,本公开的实施例提供了一种用于发送数据的方法,该方法包括:接收通信连接的客户端发送的请求信息;响应于确定第一服务器组中存在至少一个运行状态为第一状态的第一服务器,从至少一个第一服务器中确定目标服务器;将请求信息发送至目标服务器。In a first aspect, an embodiment of the present disclosure provides a method for sending data, the method comprising: receiving request information sent by a client of a communication connection; in response to determining that there is at least one running state in the first server group A first server in a state determines a target server from at least one first server; and sends the request information to the target server.

在一些实施例中,该方法还包括:响应于确定第一服务器组中不存在运行状态为第一状态的第一服务器,且第二服务器组中存在至少一个运行状态为第一状态的第二服务器,从至少一个第二服务器中确定目标服务器。In some embodiments, the method further includes: in response to determining that there is no first server in the first server group whose operating state is the first state, and at least one second server whose operating state is the first state exists in the second server group The server determines the target server from the at least one second server.

在一些实施例中,该方法还包括:响应于确定目标服务器为第二服务器,且检测到运行状态从第二状态恢复到第一状态的第一服务器,将目标服务器切换为恢复到第一状态的第一服务器。In some embodiments, the method further includes: in response to determining that the target server is the second server and detecting that the first server whose operating state is restored from the second state to the first state, switching the target server to restore the first state the first server.

在一些实施例中,接收通信连接的客户端发送的请求信息之前,该方法还包括:获取通信连接的至少两个服务器的优先级标识信息;根据至少两个服务器的优先级标识信息,将至少两个服务器划分为第一服务器组和第二服务器组。In some embodiments, before receiving the request information sent by the client of the communication connection, the method further includes: acquiring priority identification information of at least two servers of the communication connection; The two servers are divided into a first server group and a second server group.

第二方面,本公开的实施例提供了一种用于发送数据的装置,该装置包括:信息接收单元,被配置成接收通信连接的客户端发送的请求信息;目标确定单元,被配置成响应于确定第一服务器组中存在至少一个运行状态为第一状态的第一服务器,从至少一个第一服务器中确定目标服务器;信息发送单元,被配置成将请求信息发送至目标服务器。In a second aspect, an embodiment of the present disclosure provides an apparatus for sending data, the apparatus comprising: an information receiving unit configured to receive request information sent by a client of a communication connection; a target determination unit configured to respond to After determining that there is at least one first server in the first server group whose operating state is the first state, a target server is determined from the at least one first server; the information sending unit is configured to send the request information to the target server.

在一些实施例中,目标确定单元,被进一步配置成:响应于确定第一服务器组中不存在运行状态为第一状态的第一服务器,且第二服务器组中存在至少一个运行状态为第一状态的第二服务器,从至少一个第二服务器中确定目标服务器。In some embodiments, the target determination unit is further configured to: in response to determining that there is no first server in the first server group whose operating state is the first state, and at least one server whose operating state is the first state exists in the second server group A state of the second server, the target server is determined from the at least one second server.

在一些实施例中,目标确定单元,被进一步配置成:响应于确定目标服务器为第二服务器,且检测到运行状态从第二状态恢复到第一状态的第一服务器,将目标服务器切换为恢复到第一状态的第一服务器。In some embodiments, the target determination unit is further configured to: in response to determining that the target server is the second server and detecting that the first server whose operating state is restored from the second state to the first state, switches the target server to restore to the first server in the first state.

在一些实施例中,该装置还包括:标识获取单元,被配置成获取通信连接的至少两个服务器的优先级标识信息;分组确定单元,被配置成根据至少两个服务器的优先级标识信息,将至少两个服务器划分为第一服务器组和第二服务器组。In some embodiments, the apparatus further includes: an identification acquisition unit configured to acquire priority identification information of at least two servers in communication connection; a grouping determination unit configured to obtain priority identification information of at least two servers according to the priority identification information of the at least two servers, The at least two servers are divided into a first server group and a second server group.

第三方面,本公开的实施例提供了一种用于发送数据的系统,该系统包括:客户端、负载均衡器、第一服务器组,其中:客户端,用于向负载均衡器发送请求信息;负载均衡器,用于接收客户端发送的请求信息;响应于确定第一服务器组中存在至少一个运行状态为第一状态的第一服务器,从至少一个第一服务器中确定目标服务器;以及将请求信息发送至目标服务器;第一服务器组,用于对所接收到的、负载均衡器发送的请求信息进行处理。In a third aspect, an embodiment of the present disclosure provides a system for sending data, the system includes: a client, a load balancer, and a first server group, wherein: the client is configured to send request information to the load balancer a load balancer, configured to receive request information sent by a client; in response to determining that there is at least one first server in the first server group whose operating state is the first state, determining a target server from the at least one first server; and The request information is sent to the target server; the first server group is used to process the received request information sent by the load balancer.

在一些实施例中,系统还包括:第二服务器组,其中:负载均衡器,还用于响应于确定第一服务器组中不存在运行状态为第一状态的第一服务器,且第二服务器组中存在至少一个运行状态为第一状态的第二服务器,从至少一个第二服务器中确定目标服务器;第二服务器组,用于对所接收到的、负载均衡器发送的请求信息进行处理。In some embodiments, the system further includes: a second server group, wherein: the load balancer is further configured to respond to determining that there is no first server in the first server group whose running state is the first state, and the second server group does not exist There is at least one second server in the first state, and the target server is determined from the at least one second server; the second server group is used to process the received request information sent by the load balancer.

第四方面,本公开的实施例提供了一种电子设备,该电子设备包括:一个或多个处理器;存储装置,其上存储有一个或多个程序;当该一个或多个程序被该一个或多个处理器执行,使得该一个或多个处理器实现如第一方面中任一实现方式描述的方法。In a fourth aspect, embodiments of the present disclosure provide an electronic device, the electronic device comprising: one or more processors; a storage device on which one or more programs are stored; when the one or more programs are stored by the one or more programs One or more processors execute such that the one or more processors implement a method as described in any implementation of the first aspect.

第五方面,本公开的实施例提供了一种计算机可读介质,其上存储有计算机程序,该程序被处理器执行时实现如第一方面中任一实现方式描述的方法。In a fifth aspect, embodiments of the present disclosure provide a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, implements the method described in any implementation manner of the first aspect.

本公开的实施例提供的用于发送数据的方法和装置,可以接收通信连接的客户端发送的请求信息。然后,响应于确定第一服务器组中存在至少一个运行状态为第一状态的第一服务器,从至少一个第一服务器中确定目标服务器。最后,将请求信息发送至目标服务器。本公开的实施例提供的方法和装置,可以通过在转发请求时对服务器状态进行检测,实现将来自于客户端的请求信息转发给指定运行状态的目标服务器。The method and apparatus for sending data provided by the embodiments of the present disclosure can receive request information sent by a client in a communication connection. Then, in response to determining that there is at least one first server whose operating state is the first state in the first server group, a target server is determined from the at least one first server. Finally, the request information is sent to the target server. The method and apparatus provided by the embodiments of the present disclosure can forward the request information from the client to the target server in the specified running state by detecting the server state when forwarding the request.

附图说明Description of drawings

通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本公开的其它特征、目的和优点将会变得更明显:Other features, objects and advantages of the present disclosure will become more apparent upon reading the detailed description of non-limiting embodiments taken with reference to the following drawings:

图1是本公开的一个实施例可以应用于其中的示例性系统架构图;FIG. 1 is an exemplary system architecture diagram to which an embodiment of the present disclosure may be applied;

图2是根据本公开的用于发送数据的方法的一个实施例的流程图;2 is a flowchart of one embodiment of a method for transmitting data according to the present disclosure;

图3是根据本公开的实施例的用于发送数据的方法的一个应用场景的示意图;3 is a schematic diagram of an application scenario of the method for sending data according to an embodiment of the present disclosure;

图4是根据本公开的用于发送数据的方法的又一个实施例的流程图;4 is a flowchart of yet another embodiment of a method for transmitting data according to the present disclosure;

图5是根据本公开的用于发送数据的装置的一个实施例的结构示意图;5 is a schematic structural diagram of an embodiment of an apparatus for sending data according to the present disclosure;

图6是根据本公开的用于发送数据的系统的一个实施例的时序图;6 is a timing diagram of one embodiment of a system for transmitting data according to the present disclosure;

图7是适于用来实现本公开的实施例的电子设备的结构示意图。7 is a schematic structural diagram of an electronic device suitable for implementing embodiments of the present disclosure.

具体实施方式Detailed ways

下面结合附图和实施例对本公开作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与有关发明相关的部分。The present disclosure will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the related invention, but not to limit the invention. In addition, it should be noted that, for the convenience of description, only the parts related to the related invention are shown in the drawings.

需要说明的是,在不冲突的情况下,本公开中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本公开。It should be noted that the embodiments of the present disclosure and the features of the embodiments may be combined with each other under the condition of no conflict. The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.

图1示出了可以应用本公开的实施例的用于发送数据的方法或用于发送数据的装置的示例性系统架构100。FIG. 1 illustrates an exemplary system architecture 100 of a method for transmitting data or an apparatus for transmitting data to which embodiments of the present disclosure may be applied.

如图1所示,系统架构100可以包括客户端101,网络102、103,负载均衡器104和第一服务器组105。网络102、103用以在客户端101、负载均衡器104和第一服务器组105之间提供通信链路的介质。网络102、103可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。在实践中,网络102、103可以是同一个网络。As shown in FIG. 1 , the system architecture 100 may include a client 101 , networks 102 , 103 , a load balancer 104 and a first server group 105 . The networks 102 , 103 are used to provide a medium of communication links between the client 101 , the load balancer 104 and the first server group 105 . The networks 102, 103 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others. In practice, the networks 102, 103 may be the same network.

客户端101可以通过网络102与负载均衡器104交互,以接收或发送消息等。客户端101上可以安装有各种应用,例如搜索类应用、查错类应用、导航类应用等。客户端101可以是硬件,也可以是软件。当客户端101为硬件时,可以是支持请求信息发送的各种电子设备,包括但不限于智能手机、平板电脑、膝上型便携计算机和台式计算机等等。当客户端101为软件时,可以安装在上述所列举的电子设备中。其可以实现成多个软件或软件模块(例如用来提供分布式服务),也可以实现成单个软件或软件模块。在此不做具体限定。Clients 101 may interact with load balancer 104 over network 102 to receive or send messages and the like. Various applications may be installed on the client 101, such as search applications, error checking applications, and navigation applications. The client 101 may be hardware or software. When the client 101 is hardware, it may be various electronic devices that support requesting information transmission, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like. When the client 101 is software, it can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules (eg, to provide distributed services), or as a single software or software module. There is no specific limitation here.

负载均衡器104可以是提供负载均衡服务的服务器,例如,为客户端101所发送的请求信息确定目标服务器,以及将请求信息发送给目标服务器的服务器。负载均衡器104可以接收通信连接的客户端101发送的请求信息。然后,响应于确定第一服务器组105中存在至少一个运行状态为第一状态的第一服务器,从至少一个第一服务器中确定目标服务器。最后,将请求信息发送至目标服务器。另外,负载均衡器104还可以接收目标服务器针对请求信息发送的应答信息,以及将所接收到的应答信息发送给客户端101。The load balancer 104 may be a server that provides load balancing services, for example, a server that determines a target server for request information sent by the client 101 and sends the request information to the target server. The load balancer 104 can receive the request information sent by the client 101 of the communication connection. Then, in response to determining that there is at least one first server whose operating state is the first state in the first server group 105, a target server is determined from the at least one first server. Finally, the request information is sent to the target server. In addition, the load balancer 104 may also receive the response information sent by the target server for the request information, and send the received response information to the client 101 .

第一服务器组105可以是由多个服务器组成的服务器组,服务器组中的服务器可以是提供各种服务的服务器,例如,对负载均衡器104所转发的请求信息进行处理的服务器。第一服务器组105中的服务器可以作为目标服务器接收负载均衡器104发送的请求信息,以及针对所接收到的请求信息进行相应处理。The first server group 105 may be a server group composed of multiple servers, and the servers in the server group may be servers that provide various services, for example, servers that process request information forwarded by the load balancer 104 . The servers in the first server group 105 may serve as target servers to receive the request information sent by the load balancer 104, and perform corresponding processing on the received request information.

需要说明的是,服务器可以是硬件,也可以是软件。当服务器为硬件时,可以实现成多个服务器组成的分布式服务器集群,也可以实现成单个服务器。当服务器为软件时,可以实现成多个软件或软件模块(例如用来提供分布式服务),也可以实现成单个软件或软件模块。在此不做具体限定。It should be noted that the server may be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or can be implemented as a single server. When the server is software, it can be implemented as a plurality of software or software modules (for example, for providing distributed services), or it can be implemented as a single software or software module. There is no specific limitation here.

需要说明的是,本公开的实施例所提供的用于发送数据的方法一般由负载均衡器104执行,相应地,用于发送数据的装置一般设置于负载均衡器104中。It should be noted that the method for sending data provided by the embodiments of the present disclosure is generally performed by the load balancer 104 , and correspondingly, the apparatus for sending data is generally set in the load balancer 104 .

应该理解,图1中的客户端、网络、负载均衡器和第一服务器组的数目仅仅是示意性的。根据实现需要,可以具有任意数目的客户端、网络、负载均衡器和第一服务器组。It should be understood that the numbers of clients, networks, load balancers and first server groups in FIG. 1 are merely illustrative. There can be any number of clients, networks, load balancers, and first server groups depending on implementation needs.

继续参考图2,示出了根据本公开的用于发送数据的方法的一个实施例的流程200。该用于发送数据的方法,包括以下步骤:With continued reference to FIG. 2, a flow 200 of one embodiment of a method for transmitting data in accordance with the present disclosure is shown. The method for sending data includes the following steps:

步骤201,接收通信连接的客户端发送的请求信息。Step 201: Receive request information sent by the client of the communication connection.

在本实施例中,用于发送数据的方法的执行主体(例如图1所示的负载均衡器104)可以通过有线连接方式或者无线连接方式,接收到通信连接的客户端发送的请求信息。其中,上述请求信息可以是用于请求服务的各种信息。作为示例,上述请求信息可以是用于请求访问某网站的信息。In this embodiment, the execution body of the method for sending data (for example, the load balancer 104 shown in FIG. 1 ) may receive the request information sent by the client in the communication connection through a wired connection or a wireless connection. Wherein, the above-mentioned request information may be various information for requesting a service. As an example, the above-mentioned request information may be information for requesting access to a certain website.

步骤202,响应于确定第一服务器组中存在至少一个运行状态为第一状态的第一服务器,从至少一个第一服务器中确定目标服务器。Step 202, in response to determining that there is at least one first server in the first server group whose operating state is the first state, determine a target server from the at least one first server.

在本实施例中,在接收到客户端发送的请求信息后,执行主体可以确定第一服务器组中的每个第一服务器的运行状态。其中,上述第一服务器通常是指能够对所接收到的、负载均衡器发送的请求信息进行处理的服务器。In this embodiment, after receiving the request information sent by the client, the execution body may determine the running state of each first server in the first server group. The above-mentioned first server generally refers to a server capable of processing the received request information sent by the load balancer.

其中,对于第一服务器组中的任一第一服务器,执行主体可以先得到该第一服务器的状态信息。其中,上述状态信息可以是用于表征运行状态的信息。作为示例,上述状态信息可以是数字“1”,也可以是字符组“yes”,用于表征运行状态为第一状态。作为另一示例,上述状态信息可以是数字“0”,也可以是字符组“no”,用于表征运行状态为第二状态。其中,第一状态通常是用于表征服务器可用的状态。第二状态通常是用于表征服务器不可用的状态。需要指出的是,执行主体可以通过接收该第一服务器按照设定的周期发送状态信息的方式,来得到该第一服务器的状态信息。执行主体也可以通过主动从该第一服务器中获取状态信息的方式,得到该第一服务器的状态信息。Wherein, for any first server in the first server group, the execution subject may first obtain the state information of the first server. Wherein, the above state information may be information used to characterize the running state. As an example, the above state information may be a number "1" or a character group "yes", which is used to indicate that the running state is the first state. As another example, the above state information may be a number "0" or a character group "no", which is used to indicate that the running state is the second state. Wherein, the first state is usually a state used to characterize the availability of the server. The second state is usually a state used to characterize the server being unavailable. It should be noted that the execution body may obtain the state information of the first server by receiving the state information sent by the first server according to a set period. The execution body may also obtain the state information of the first server by actively acquiring the state information from the first server.

在本实施例中,在得到第一服务器组中的每个第一服务器的运行状态后,执行主体可以确定第一服务器组中是否存在运行状态为第一状态的第一服务器。In this embodiment, after obtaining the operating state of each first server in the first server group, the execution subject may determine whether there is a first server whose operating state is the first state in the first server group.

在本实施例中,若第一服务器组中存在运行状态为第一状态的第一服务器,则执行主体可以采用负载均衡算法,从至少一个运行状态为第一状态的第一服务器中选择第一服务器,作为目标服务器。作为示例,上述负载均衡算法可以为轮询调度算法(RoundRobin,RR)、加权轮询调度算法(Weight Round Robin,WRR)、源地址哈希调度算法(SourceIP Hash,SrcHash)、最小连接调度算法(Minimum Connection,MinConn)等。In this embodiment, if there is a first server whose running state is the first state in the first server group, the execution subject may use a load balancing algorithm to select the first server from at least one first server whose running state is the first state server, as the target server. As an example, the above load balancing algorithm may be a round-robin scheduling algorithm (RoundRobin, RR), a weighted round-robin scheduling algorithm (Weight Round Robin, WRR), a source address hash scheduling algorithm (SourceIP Hash, SrcHash), a least connection scheduling algorithm ( Minimum Connection, MinConn) et al.

在本实施例的一些可选的实现方式中,响应于确定第一服务器组中不存在运行状态为第一状态的第一服务器,且第二服务器组中存在至少一个运行状态为第一状态的第二服务器,从至少一个第二服务器中确定目标服务器。In some optional implementations of this embodiment, in response to determining that there is no first server whose running state is the first state in the first server group, and at least one server whose running state is the first state exists in the second server group The second server determines the target server from the at least one second server.

其中,上述第二服务器通常是指能够对所接收到的、负载均衡器发送的请求信息进行处理的服务器。The above-mentioned second server generally refers to a server capable of processing the received request information sent by the load balancer.

本实现方式中,若第一服务器组中不存在运行状态为第一状态的第一服务器,执行主体可以通过确定第二服务器组中的每个第二服务器的运行状态,来得到运行状态为第一状态的第二服务器。从而,采用负载均衡算法,从至少一个运行状态为第一状态的第二服务器中选择第二服务器,作为目标服务器。这里,确定第二服务器组中的每个第二服务器的运行状态的方式,与上述确定第一服务器组中的每个第一服务器的运行状态的方式,基本相同,这里不做赘述。In this implementation manner, if there is no first server whose operating state is the first state in the first server group, the execution subject can obtain the operating state of the first server by determining the operating state of each second server in the second server group. A state of the second server. Therefore, a load balancing algorithm is used to select a second server from at least one second server whose running state is in the first state as a target server. Here, the manner of determining the running state of each second server in the second server group is basically the same as the foregoing manner of determining the running status of each first server in the first server group, and will not be repeated here.

需要指出的是,本实现方式中,在第一服务器组中的所有第一服务器均不可用之后,执行主体可以从第二服务器组中选择第二服务器作为目标服务器,以使得第二服务器组中的第二服务器可以继续对客户端的请求信息进行处理。可以避免因为第一服务器组中的服务器均不可用导致的服务器调度失败的情况。可以保障从负载均衡器到服务器之间的链路的通畅,避免因调度失败而丢包。有助于实现及时针对客户端的请求信息进行处理。It should be pointed out that, in this implementation manner, after all the first servers in the first server group are unavailable, the execution subject may select the second server from the second server group as the target server, so that the second server group is The second server can continue to process the client's request information. It is possible to avoid the situation that the server scheduling fails because none of the servers in the first server group are available. It can ensure the smoothness of the link between the load balancer and the server, and avoid packet loss due to scheduling failure. It is helpful to realize timely processing of the client's request information.

在本实施例的一些可选的实现方式中,响应于确定目标服务器为第二服务器,且检测到运行状态从第二状态恢复到第一状态的第一服务器,将目标服务器切换为恢复到第一状态的第一服务器。In some optional implementations of this embodiment, in response to determining that the target server is the second server and detecting that the first server whose running state is restored from the second state to the first state is detected, the target server is switched to be restored to the first server. A state of the first server.

本实现方式中,在目标服务器为第二服务器时,若检测到存在运行状态从第二状态恢复到第一状态的第一服务器。此时,执行主体可以将恢复到第一状态的第一服务器作为目标服务器,即,将目标服务器从第二服务器切换为第一服务器。需要指出的是,第一服务器的数据处理能力通常要高于第二服务器的数据处理能力。本实现方式中,及时将目标服务器切换为恢复到第一状态的第一服务器,可以实现采用数据处理能力更强的第一服务器对客户端的请求信息进行处理,有助于提高数据处理效率。In this implementation manner, when the target server is the second server, if it is detected that there is a first server whose running state is restored from the second state to the first state. At this time, the execution body may use the first server restored to the first state as the target server, that is, switch the target server from the second server to the first server. It should be noted that the data processing capability of the first server is generally higher than the data processing capability of the second server. In this implementation manner, the target server is switched to the first server restored to the first state in time, so that the first server with stronger data processing capability can be used to process the request information of the client, which helps to improve the data processing efficiency.

在实践中,上述第一服务器组和第二服务器组可以分别是主服务器组和备用服务器组。负载均衡设备可以实时监控各服务器的状态,在主服务器组中有可用的服务器时,将请求转发至可用的主服务器;在所有主服务器都不可用时,将请求转发至可用的备用服务器。在备用服务器提供服务过程中,一旦检测到主服务器组中有主服务器恢复可用,则将实时接收到的请求转发至主服务器。这样可以保证系统的稳定运行。In practice, the above-mentioned first server group and second server group may be a primary server group and a backup server group, respectively. The load balancing device can monitor the status of each server in real time. When there are available servers in the master server group, it forwards the request to the available master server; when all the master servers are unavailable, it forwards the request to the available backup server. During the service process of the standby server, once it is detected that a master server in the master server group is available again, the request received in real time is forwarded to the master server. This can ensure the stable operation of the system.

步骤203,将请求信息发送至目标服务器。Step 203, sending the request information to the target server.

在本实施例中,上述执行主体可以通过有线连接方式或者无线连接方式,将请求信息发送给目标服务器。目标服务器可以解析请求信息,并进行相应的处理。In this embodiment, the above-mentioned execution subject may send the request information to the target server in a wired connection manner or a wireless connection manner. The target server can parse the request information and process it accordingly.

继续参见图3,图3是根据本实施例的用于发送数据的方法的应用场景300的一个示意图。在图3的应用场景中,用户301通过客户端302向通信连接的负载均衡器303发送请求信息。请求信息可以为:“请求访问XX网站”。Continue to refer to FIG. 3 , which is a schematic diagram of an application scenario 300 of the method for sending data according to this embodiment. In the application scenario of FIG. 3 , the user 301 sends request information to the communication-connected load balancer 303 through the client 302 . The request information can be: "request to visit XX website".

首先,负载均衡器303可以接收到请求信息“请求访问XX网站”。First, the load balancer 303 may receive the request information "request to visit XX website".

之后,负载均衡器303可以确定第一服务器组304中的每个第一服务器的运行状态。其中,第一服务器组304中的第一服务器有S1,S2和S3。此时,可以得到第一服务器S1的运行状态为第一状态,第一服务器S2的运行状态为第一状态,第一服务器S3的运行状态为第二状态。After that, the load balancer 303 may determine the running status of each first server in the first server group 304 . The first servers in the first server group 304 include S1, S2 and S3. At this time, it can be obtained that the operating state of the first server S1 is the first state, the operating state of the first server S2 is the first state, and the operating state of the first server S3 is the second state.

然后,负载均衡器303可以从运行状态为第一状态的第一服务器S1,S2中,确定第一服务器S1作为目标服务器。Then, the load balancer 303 may determine the first server S1 as the target server from the first servers S1 and S2 whose operating states are in the first state.

最后,负载均衡器303可以将请求信息“请求访问XX网站”,发送至目标服务器S1。Finally, the load balancer 303 may send the request information "request to access the XX website" to the target server S1.

本公开的上述实施例提供的用于发送数据的方法,可以接收通信连接的客户端发送的请求信息。然后,响应于确定第一服务器组中存在至少一个运行状态为第一状态的第一服务器,从至少一个第一服务器中确定目标服务器。最后,将请求信息发送至目标服务器。本实施例的方法,可以通过在转发请求时对服务器状态进行检测实现将来自于客户端的请求信息转发给指定运行状态的目标服务器。The method for sending data provided by the above embodiments of the present disclosure can receive request information sent by a client of a communication connection. Then, in response to determining that there is at least one first server whose operating state is the first state in the first server group, a target server is determined from the at least one first server. Finally, the request information is sent to the target server. In the method of this embodiment, the request information from the client can be forwarded to the target server in the specified running state by detecting the server state when forwarding the request.

进一步参考图4,其示出了用于发送数据的方法的又一个实施例的流程400。该用于发送数据的方法的流程400,包括以下步骤:With further reference to Figure 4, a flow 400 of yet another embodiment of a method for transmitting data is shown. The process 400 of the method for sending data includes the following steps:

步骤401,获取通信连接的至少两个服务器的优先级标识信息。Step 401: Acquire priority identification information of at least two servers in communication connection.

在本实施例中,执行主体可以通过有线连接方式或者无线连接方式,获取到通信连接的至少两个服务器的优先级标识信息。其中,上述服务器通常是指能够对负载均衡器所发送的请求信息进行处理的服务器。上述优先级标识信息通常是用于表征服务器的优先级的信息。作为示例,上述优先级标识信息可以是数字“1”,也可以是字符组“high”,用于表征服务器的优先级高。作为另一示例,上述优先级标识信息可以是数字“0”,也可以是字符组“low”,用于表征服务器的优先级低。In this embodiment, the execution subject may acquire priority identification information of at least two servers connected to the communication through a wired connection or a wireless connection. The above-mentioned server generally refers to a server capable of processing the request information sent by the load balancer. The above-mentioned priority identification information is generally information used to characterize the priority of the server. As an example, the above priority identification information may be a number "1" or a character group "high", which is used to indicate that the priority of the server is high. As another example, the above priority identification information may be a number "0" or a character group "low", which is used to indicate that the priority of the server is low.

步骤402,根据至少两个服务器的优先级标识信息,将至少两个服务器划分为第一服务器组和第二服务器组。Step 402: Divide the at least two servers into a first server group and a second server group according to the priority identification information of the at least two servers.

在本实施例中,执行主体可以采用各个服务器的优先级标识信息对所有服务器进行分组。作为示例,执行主体可以将表征优先级高的优先级标识信息所对应的服务器划分入第一服务器组,以及将表征优先级低的优先级标识信息所对应的服务器划分入第二服务器组。In this embodiment, the execution subject may use the priority identification information of each server to group all servers. As an example, the execution body may divide the servers corresponding to the priority identification information representing high priorities into the first server group, and the servers corresponding to the priority identification information representing low priorities into the second server group.

这里,对服务器进行分组,可以实现优先从优先级高的第一服务器组中选择服务器作为目标服务器。由于优先级高的服务器的数据处理能力通常要高于优先级低的服务器的数据处理能力。因此,本实施例中,优先从优先级高的第一服务器组中选择服务器作为目标服务器,可以实现采用数据处理能力更强的服务器对客户端的请求信息进行处理,有助于提高数据处理效率。Here, by grouping the servers, it is possible to preferentially select a server from the first server group with a high priority as a target server. Because the data processing capability of the server with high priority is usually higher than that of the server with low priority. Therefore, in this embodiment, the server is preferentially selected from the first server group with high priority as the target server, so that the server with stronger data processing capability can be used to process the request information of the client, which helps to improve the data processing efficiency.

步骤403,接收通信连接的客户端发送的请求信息。Step 403: Receive the request information sent by the client of the communication connection.

步骤404,响应于确定第一服务器组中存在至少一个运行状态为第一状态的第一服务器,从至少一个第一服务器中确定目标服务器。Step 404, in response to determining that there is at least one first server in the first server group whose operating state is the first state, determine a target server from the at least one first server.

步骤405,将请求信息发送至目标服务器。Step 405, sending the request information to the target server.

在本实施例中,步骤403-405的具体操作与图2所示的实施例中步骤201-203的操作基本相同,在此不再赘述。In this embodiment, the specific operations of steps 403 to 405 are basically the same as the operations of steps 201 to 203 in the embodiment shown in FIG. 2 , and details are not repeated here.

从图4中可以看出,与图2对应的实施例相比,本实施例中的用于发送数据的方法的流程400突出了对通信连接的服务器进行分组的步骤。由此,本实施例描述的方案可以通过对服务器预先配置优先级标识信息并基于优先级标识信息来分组,实现优先从优先级高的第一服务器组中选择服务器作为目标服务器,有助于提高数据处理效率。As can be seen from FIG. 4 , compared with the embodiment corresponding to FIG. 2 , the flow 400 of the method for sending data in this embodiment highlights the step of grouping the servers connected in communication. Therefore, in the solution described in this embodiment, servers can be preconfigured with priority identification information and grouped based on the priority identification information, so that servers can be preferentially selected from the first server group with high priority as target servers, which is helpful for improving Data processing efficiency.

进一步参考图5,作为对上述各图所示方法的实现,本公开提供了一种用于发送数据的装置的一个实施例,该装置实施例与图2所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。Referring further to FIG. 5 , as an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of an apparatus for sending data. The apparatus embodiment corresponds to the method embodiment shown in FIG. 2 . The device can be specifically applied to various electronic devices.

如图5所示,本实施例的用于发送数据的装置500包括:信息接收单元501,被配置成接收通信连接的客户端发送的请求信息;目标确定单元502,被配置成响应于确定第一服务器组中存在至少一个运行状态为第一状态的第一服务器,从至少一个第一服务器中确定目标服务器;信息发送单元503,被配置成将请求信息发送至目标服务器。As shown in FIG. 5 , the apparatus 500 for sending data in this embodiment includes: an information receiving unit 501, which is configured to receive request information sent by a client of communication connection; a target determining unit 502, which is configured to respond to determining the first There is at least one first server in a server group whose running state is the first state, and a target server is determined from the at least one first server; the information sending unit 503 is configured to send the request information to the target server.

在本实施例的一些可选的实现方式中,上述目标确定单元502,可以被进一步配置成:响应于确定第一服务器组中不存在运行状态为第一状态的第一服务器,且第二服务器组中存在至少一个运行状态为第一状态的第二服务器,从至少一个第二服务器中确定目标服务器In some optional implementations of this embodiment, the above-mentioned target determining unit 502 may be further configured to: in response to determining that there is no first server whose running state is the first state in the first server group, and the second server There is at least one second server running in the first state in the group, and the target server is determined from the at least one second server

在本实施例的一些可选的实现方式中,上述目标确定单元502,可以被进一步配置成:响应于确定目标服务器为第二服务器,且检测到运行状态从第二状态恢复到第一状态的第一服务器,将目标服务器切换为恢复到第一状态的第一服务器。In some optional implementations of this embodiment, the above target determining unit 502 may be further configured to: in response to determining that the target server is the second server and detecting that the running state is restored from the second state to the first state The first server switches the target server to the first server restored to the first state.

在本实施例的一些可选的实现方式中,该装置还包括标识获取单元和分组确定单元(图中未示出)。其中,标识获取单元可以被配置成获取通信连接的至少两个服务器的优先级标识信息。分组确定单元,可以被配置成根据至少两个服务器的优先级标识信息,将至少两个服务器划分为第一服务器组和第二服务器组。In some optional implementations of this embodiment, the apparatus further includes an identification acquiring unit and a grouping determining unit (not shown in the figure). Wherein, the identification obtaining unit may be configured to obtain priority identification information of at least two servers in communication connection. The grouping determining unit may be configured to divide the at least two servers into a first server group and a second server group according to the priority identification information of the at least two servers.

本公开的上述实施例提供的装置,信息接收单元501接收通信连接的客户端发送的请求信息。然后,目标确定单元502响应于确定第一服务器组中存在至少一个运行状态为第一状态的第一服务器,从至少一个第一服务器中确定目标服务器。最后,信息发送单元503将请求信息发送至目标服务器。本实施例的装置,可以通过在转发请求时对服务器状态进行检测,实现将来自于客户端的请求信息转发给指定运行状态的目标服务器。In the apparatus provided by the above-mentioned embodiments of the present disclosure, the information receiving unit 501 receives the request information sent by the client of the communication connection. Then, the target determining unit 502 determines a target server from the at least one first server in response to determining that there is at least one first server whose operating state is the first state in the first server group. Finally, the information sending unit 503 sends the request information to the target server. The apparatus of this embodiment can forward the request information from the client to the target server in the specified running state by detecting the server state when forwarding the request.

进一步参考图6,其示出了根据本公开的用于发送数据的系统的一个实施例的时序600。With further reference to FIG. 6, a timing sequence 600 of one embodiment of a system for transmitting data in accordance with the present disclosure is shown.

本公开的用于发送数据的系统包括:客户端、负载均衡器、第一服务器组,其中:客户端,用于向负载均衡器发送请求信息。负载均衡器,用于接收客户端发送的请求信息。响应于确定第一服务器组中存在至少一个运行状态为第一状态的第一服务器,从至少一个第一服务器中确定目标服务器;以及将请求信息发送至目标服务器。第一服务器组,用于对所接收到的、负载均衡器发送的请求信息进行处理。The system for sending data of the present disclosure includes: a client, a load balancer, and a first server group, wherein: the client is used for sending request information to the load balancer. The load balancer is used to receive the request information sent by the client. In response to determining that there is at least one first server whose operating state is the first state in the first server group, determining a target server from the at least one first server; and sending request information to the target server. The first server group is used to process the received request information sent by the load balancer.

在本实施例的一些可选的实现方式中,该系统还包括:第二服务器组。其中:负载均衡器,还用于响应于确定第一服务器组中不存在运行状态为第一状态的第一服务器,且第二服务器组中存在至少一个运行状态为第一状态的第二服务器,从至少一个第二服务器中确定目标服务器。第二服务器组,用于对所接收到的、负载均衡器发送的请求信息进行处理。In some optional implementations of this embodiment, the system further includes: a second server group. Wherein: the load balancer is further configured to respond to determining that there is no first server in the first server group whose operating state is in the first state, and there is at least one second server in the second server group whose operating state is in the first state, The target server is determined from the at least one second server. The second server group is used to process the received request information sent by the load balancer.

如图6所示,本实施例的客户端、负载均衡器、第一服务器组和第二服务器组之间的信令流的主要过程可以包括如下步骤:As shown in FIG. 6 , the main process of the signaling flow between the client, the load balancer, the first server group, and the second server group in this embodiment may include the following steps:

步骤601,客户端向负载均衡器发送请求信息。Step 601, the client sends request information to the load balancer.

步骤602,负载均衡器接收客户端发送的请求信息。Step 602, the load balancer receives the request information sent by the client.

步骤6031,负载均衡器确定第一服务器组中存在至少一个运行状态为第一状态的第一服务器。Step 6031, the load balancer determines that there is at least one first server whose running state is the first state in the first server group.

步骤6032,负载均衡器从至少一个第一服务器中确定目标服务器。Step 6032, the load balancer determines a target server from at least one first server.

步骤6033,负载均衡器将请求信息发送至被确定为目标服务器的第一服务器。Step 6033, the load balancer sends the request information to the first server determined as the target server.

步骤6034,第一服务器组中的被确定为目标服务器的第一服务器对请求信息进行处理。Step 6034: The first server in the first server group that is determined to be the target server processes the request information.

步骤6041,负载均衡器确定第一服务器组中不存在运行状态为第一状态的第一服务器,且第二服务器组中存在至少一个运行状态为第一状态的第二服务器。Step 6041: The load balancer determines that there is no first server in the first server group whose running state is in the first state, and there is at least one second server whose running state is in the first state in the second server group.

步骤6042,负载均衡器从至少一个第二服务器中确定目标服务器。Step 6042, the load balancer determines a target server from at least one second server.

步骤6043,负载均衡器将请求信息发送至被确定为目标服务器的第二服务器。Step 6043, the load balancer sends the request information to the second server determined as the target server.

步骤6044,第二服务器组中的被确定为目标服务器的第二服务器对请求信息进行处理。Step 6044: The second server in the second server group that is determined to be the target server processes the request information.

下面参考图7,其示出了适于用来实现本公开的实施例的电子设备(例如图1中的负载均衡器)700的结构示意图。图7示出的电子设备仅仅是一个示例,不应对本公开的实施例的功能和使用范围带来任何限制。Referring next to FIG. 7 , it shows a schematic structural diagram of an electronic device (eg, the load balancer in FIG. 1 ) 700 suitable for implementing embodiments of the present disclosure. The electronic device shown in FIG. 7 is only an example, and should not impose any limitation on the function and scope of use of the embodiments of the present disclosure.

如图7所示,电子设备700可以包括处理装置(例如中央处理单元(CPU)、图形处理器等)701,其可以根据存储在只读存储器(ROM)702中的程序或者从存储装置708加载到随机访问存储器(RAM)703中的程序而执行各种适当的动作和处理。在RAM 703中,还存储有电子设备700操作所需的各种程序和数据。处理装置701、ROM 702以及RAM 703通过总线704彼此相连。输入/输出(I/O)接口705也连接至总线704。As shown in FIG. 7 , an electronic device 700 may include a processing device (eg, a central processing unit (CPU), a graphics processor, etc.) 701 that may be loaded according to a program stored in a read only memory (ROM) 702 or from a storage device 708 A program in random access memory (RAM) 703 executes various appropriate actions and processes. In the RAM 703, various programs and data necessary for the operation of the electronic device 700 are also stored. The processing device 701 , the ROM 702 , and the RAM 703 are connected to each other through a bus 704 . An input/output (I/O) interface 705 is also connected to bus 704 .

通常,以下装置可以连接至I/O接口705:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置706;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置707;包括例如磁带、硬盘等的存储装置708;以及通信装置709。通信装置709可以允许电子设备700与其他设备进行无线或有线通信以交换数据。虽然图7示出了具有各种装置的电子设备700,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。图7中示出的每个方框可以代表一个装置,也可以根据需要代表多个装置。Typically, the following devices can be connected to the I/O interface 705: input devices 706 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speakers, vibration An output device 707 of a computer, etc.; a storage device 708 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 709. Communication means 709 may allow electronic device 700 to communicate wirelessly or by wire with other devices to exchange data. Although FIG. 7 shows an electronic device 700 having various means, it should be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in FIG. 7 can represent one device, and can also represent multiple devices as required.

特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置709从网络上被下载和安装,或者从存储装置708被安装,或者从ROM 702被安装。在该计算机程序被处理装置701执行时,执行本公开的实施例的方法中限定的上述功能。需要说明的是,本公开的实施例的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开的实施例中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开的实施例中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the method illustrated in the flowchart. In such an embodiment, the computer program may be downloaded and installed from the network via the communication device 709 , or from the storage device 708 , or from the ROM 702 . When the computer program is executed by the processing device 701, the above-described functions defined in the methods of the embodiments of the present disclosure are executed. It should be noted that the computer-readable medium of the embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples of computer readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), fiber optics, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing. In embodiments of the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. Rather, in embodiments of the present disclosure, a computer-readable signal medium may include a data signal in baseband or propagated as part of a carrier wave, carrying computer-readable program code therein. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device . Program code embodied on a computer readable medium may be transmitted using any suitable medium including, but not limited to, electrical wire, optical fiber cable, RF (radio frequency), etc., or any suitable combination of the foregoing.

上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:接收通信连接的客户端发送的请求信息;响应于确定第一服务器组中存在至少一个运行状态为第一状态的第一服务器,从至少一个第一服务器中确定目标服务器;将请求信息发送至目标服务器。The above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or may exist alone without being assembled into the electronic device. The above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device: receives the request information sent by the client of the communication connection; in response to determining the first server group There is at least one first server whose operating state is in the first state, and a target server is determined from the at least one first server; and the request information is sent to the target server.

可以以一种或多种程序设计语言或其组合来编写用于执行本公开的实施例的操作的计算机程序代码,程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for carrying out operations of embodiments of the present disclosure may be written in one or more programming languages, including object-oriented programming languages—such as Java, Smalltalk, C++, and also A conventional procedural programming language - such as the "C" language or similar programming language. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider through Internet connection).

附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented in dedicated hardware-based systems that perform the specified functions or operations , or can be implemented in a combination of dedicated hardware and computer instructions.

描述于本公开的实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元也可以设置在处理器中,例如,可以描述为:一种处理器包括信息接收单元、目标确定单元和信息发送单元。其中,这些单元的名称在某种情况下并不构成对该单元本身的限定,例如,信息接收单元还可以被描述为“接收通信连接的客户端发送的请求信息的单元”。The units involved in the embodiments of the present disclosure may be implemented in software or hardware. The described unit can also be set in the processor, for example, it can be described as: a processor includes an information receiving unit, a target determining unit and an information sending unit. Wherein, the names of these units do not constitute a limitation on the unit itself under certain circumstances. For example, the information receiving unit may also be described as "a unit that receives request information sent by a client connected to a communication".

以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述发明构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in the present disclosure is not limited to the technical solution formed by the specific combination of the above-mentioned technical features, and should also cover, without departing from the above-mentioned inventive concept, the above-mentioned technical features or Other technical solutions formed by any combination of its equivalent features. For example, a technical solution is formed by replacing the above features with the technical features disclosed in the present disclosure (but not limited to) with similar functions.

Claims (12)

Translated fromChinese
1.一种用于发送数据的方法,包括:1. A method for sending data, comprising:接收通信连接的客户端发送的请求信息;Receive the request information sent by the client of the communication connection;响应于确定第一服务器组中存在至少一个运行状态为第一状态的第一服务器,从所述至少一个第一服务器中确定目标服务器;In response to determining that there is at least one first server in the first server group whose operating state is the first state, determining a target server from the at least one first server;将所述请求信息发送至所述目标服务器。Send the request information to the target server.2.根据权利要求1所述的方法,其中,所述方法还包括:2. The method of claim 1, wherein the method further comprises:响应于确定所述第一服务器组中不存在运行状态为第一状态的第一服务器,且第二服务器组中存在至少一个运行状态为第一状态的第二服务器,从所述至少一个第二服务器中确定目标服务器。In response to determining that there is no first server in the first server group with an operating state of the first state, and there is at least one second server in the second server group with an operating state of the first state, from the at least one second server Determine the target server in the server.3.根据权利要求2所述的方法,其中,所述方法还包括:3. The method of claim 2, wherein the method further comprises:响应于确定所述目标服务器为第二服务器,且检测到运行状态从第二状态恢复到第一状态的第一服务器,将所述目标服务器切换为所述恢复到第一状态的第一服务器。In response to determining that the target server is the second server, and detecting that the operation state of the first server is restored from the second state to the first state, the target server is switched to the first server that is restored to the first state.4.根据权利要求1-3之一所述的方法,其中,所述接收通信连接的客户端发送的请求信息之前,所述方法还包括:4. The method according to any one of claims 1-3, wherein before receiving the request information sent by the client of the communication connection, the method further comprises:获取通信连接的至少两个服务器的优先级标识信息;Obtain the priority identification information of at least two servers of the communication connection;根据所述至少两个服务器的优先级标识信息,将所述至少两个服务器划分为第一服务器组和第二服务器组。The at least two servers are divided into a first server group and a second server group according to the priority identification information of the at least two servers.5.一种用于发送数据的装置,包括:5. An apparatus for sending data, comprising:信息接收单元,被配置成接收通信连接的客户端发送的请求信息;an information receiving unit, configured to receive the request information sent by the client of the communication connection;目标确定单元,被配置成响应于确定第一服务器组中存在至少一个运行状态为第一状态的第一服务器,从所述至少一个第一服务器中确定目标服务器;a target determination unit, configured to determine a target server from the at least one first server in response to determining that there is at least one first server in the first server group whose operating state is the first state;信息发送单元,被配置成将所述请求信息发送至所述目标服务器。an information sending unit, configured to send the request information to the target server.6.根据权利要求5所述的装置,其中,所述目标确定单元,被进一步配置成:6. The apparatus of claim 5, wherein the target determination unit is further configured to:响应于确定所述第一服务器组中不存在运行状态为第一状态的第一服务器,且第二服务器组中存在至少一个运行状态为第一状态的第二服务器,从所述至少一个第二服务器中确定目标服务器。In response to determining that there is no first server in the first server group with an operating state of the first state, and at least one second server with an operating state of the first state exists in the second server group, from the at least one second server Determine the target server in the server.7.根据权利要求6所述的装置,其中,所述目标确定单元,被进一步配置成:7. The apparatus of claim 6, wherein the target determination unit is further configured to:响应于确定所述目标服务器为第二服务器,且检测到运行状态从第二状态恢复到第一状态的第一服务器,将所述目标服务器切换为所述恢复到第一状态的第一服务器。In response to determining that the target server is the second server, and detecting that the operation state of the first server is restored from the second state to the first state, the target server is switched to the first server that is restored to the first state.8.根据权利要求5-7之一所述的装置,其中,所述装置还包括:8. The apparatus of one of claims 5-7, wherein the apparatus further comprises:标识获取单元,被配置成获取通信连接的至少两个服务器的优先级标识信息;an identification acquisition unit, configured to acquire priority identification information of at least two servers connected by communication;分组确定单元,被配置成根据所述至少两个服务器的优先级标识信息,将所述至少两个服务器划分为第一服务器组和第二服务器组。The grouping determination unit is configured to divide the at least two servers into a first server group and a second server group according to the priority identification information of the at least two servers.9.一种用于发送数据的系统,所述系统包括:客户端、负载均衡器、第一服务器组,其中:9. A system for sending data, the system comprising: a client, a load balancer, a first server group, wherein:所述客户端,用于向所述负载均衡器发送请求信息;the client, for sending request information to the load balancer;所述负载均衡器,用于接收所述客户端发送的所述请求信息;响应于确定所述第一服务器组中存在至少一个运行状态为第一状态的第一服务器,从所述至少一个第一服务器中确定目标服务器;以及将所述请求信息发送至所述目标服务器;The load balancer is configured to receive the request information sent by the client; in response to determining that there is at least one first server in the first server group whose running state is the first state, from the at least one first server Determine a target server in a server; and send the request information to the target server;所述第一服务器组,用于对所接收到的、所述负载均衡器发送的所述请求信息进行处理。The first server group is configured to process the received request information sent by the load balancer.10.根据权利要求9所述的系统,所述系统还包括:第二服务器组,其中:10. The system of claim 9, further comprising: a second group of servers, wherein:所述负载均衡器,还用于响应于确定所述第一服务器组中不存在运行状态为第一状态的第一服务器,且所述第二服务器组中存在至少一个运行状态为第一状态的第二服务器,从所述至少一个第二服务器中确定目标服务器;The load balancer is further configured to respond to determining that there is no first server whose running state is the first state in the first server group, and that there is at least one server whose running state is the first state in the second server group a second server, determining a target server from the at least one second server;所述第二服务器组,用于对所接收到的、所述负载均衡器发送的所述请求信息进行处理。The second server group is configured to process the received request information sent by the load balancer.11.一种电子设备,包括:11. An electronic device comprising:一个或多个处理器;one or more processors;存储装置,其上存储有一个或多个程序,a storage device on which one or more programs are stored,当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-4中任一所述的方法。The one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-4.12.一种计算机可读介质,其上存储有计算机程序,其中,该程序被处理器执行时实现如权利要求1-4中任一所述的方法。12. A computer-readable medium having stored thereon a computer program, wherein the program, when executed by a processor, implements the method of any one of claims 1-4.
CN201910208991.5A2019-03-192019-03-19 Method and apparatus for sending dataPendingCN109933432A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201910208991.5ACN109933432A (en)2019-03-192019-03-19 Method and apparatus for sending data

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201910208991.5ACN109933432A (en)2019-03-192019-03-19 Method and apparatus for sending data

Publications (1)

Publication NumberPublication Date
CN109933432Atrue CN109933432A (en)2019-06-25

Family

ID=66987717

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201910208991.5APendingCN109933432A (en)2019-03-192019-03-19 Method and apparatus for sending data

Country Status (1)

CountryLink
CN (1)CN109933432A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111930542A (en)*2020-08-182020-11-13创新奇智(成都)科技有限公司Data acquisition method and device, electronic equipment and computer readable storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN102025753A (en)*2009-09-172011-04-20阿里巴巴集团控股有限公司Load balancing method and equipment for data resources of servers
US20140196039A1 (en)*2013-01-082014-07-10Commvault Systems, Inc.Virtual machine categorization system and method
CN104270271A (en)*2011-12-212015-01-07北京奇虎科技有限公司 Disaster recovery backup system and method in Internet application
CN105553701A (en)*2015-12-112016-05-04国网青海省电力公司Distribution network adjustment and control system and control method thereof
CN109302498A (en)*2018-11-292019-02-01杭州迪普科技股份有限公司A kind of network resource access method and device
US10225331B1 (en)*2015-09-232019-03-05EMC IP Holding Company LLCNetwork address translation load balancing over multiple internet protocol addresses

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN102025753A (en)*2009-09-172011-04-20阿里巴巴集团控股有限公司Load balancing method and equipment for data resources of servers
CN104270271A (en)*2011-12-212015-01-07北京奇虎科技有限公司 Disaster recovery backup system and method in Internet application
US20140196039A1 (en)*2013-01-082014-07-10Commvault Systems, Inc.Virtual machine categorization system and method
US10225331B1 (en)*2015-09-232019-03-05EMC IP Holding Company LLCNetwork address translation load balancing over multiple internet protocol addresses
CN105553701A (en)*2015-12-112016-05-04国网青海省电力公司Distribution network adjustment and control system and control method thereof
CN109302498A (en)*2018-11-292019-02-01杭州迪普科技股份有限公司A kind of network resource access method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111930542A (en)*2020-08-182020-11-13创新奇智(成都)科技有限公司Data acquisition method and device, electronic equipment and computer readable storage medium
CN111930542B (en)*2020-08-182024-07-16创新奇智(成都)科技有限公司Data acquisition method, device, electronic equipment and computer readable storage medium

Similar Documents

PublicationPublication DateTitle
CN113783922B (en) Load balancing method, system and device
CN110311983B (en)Service request processing method, device and system, electronic equipment and storage medium
US7793140B2 (en)Method and system for handling failover in a distributed environment that uses session affinity
WO2019206296A1 (en)Fault handling method and device for gateway server
CN110177028A (en)Distributed health examination method and device
CN111432001B (en)Method, apparatus, electronic device and computer readable medium for jumping scenes
CN113553178A (en) Task processing method, device and electronic device
CN110620806B (en)Information generation method and device
CN110413457A (en) Cloud service disaster recovery method and device
CN111338834A (en)Data storage method and device
CN112416632B (en)Event communication method and device, electronic equipment and computer readable medium
CN114938395B (en)Service response method, device, equipment and storage medium
CN119902907A (en) Method and device for switching network card devices based on bonding mode
CN109933432A (en) Method and apparatus for sending data
CN118524015A (en)Distributed gateway configuration method, device, equipment and medium based on DPU
CN110233791B (en)Data deduplication method and device
CN115562892B (en) A Redis-based simulation system time management method and system, device and equipment
CN114172946B (en)Request result sending method, device, electronic equipment and computer readable medium
CN114430364B (en)Information display method, information display device, electronic equipment and computer readable medium
CN111314457B (en) Method and apparatus for setting up virtual private cloud
CN113761548B (en)Data transmission method and device for Shuffle process
US10708343B2 (en)Data repository for a distributed processing environment
CN116302140B (en) Computing terminal startup method and device based on storage and computing separation cloud native data warehouse
CN114398098B (en)Application script execution method, device, electronic equipment and computer readable medium
CN114785794B (en)Resource allocation method, device, equipment, medium and system

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination

[8]ページ先頭

©2009-2025 Movatter.jp