Method and apparatus for allocating access requests

By rationally allocating target servers based on the sending device of the access request and the load distribution of the server cluster, the problem of unbalanced load in the server cluster is solved, achieving efficient utilization of servers and complete response to access requests.

CN114003337BActive Publication Date: 2025-11-25SHENZHEN IDEAMAKE SOFTWARE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111189842.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-12
Publication Date
2025-11-25
Estimated Expiration
2041-10-12

AI Technical Summary

Technical Problem

In a server cluster, some servers may be overloaded while others are idle, leading to load imbalance and affecting the response efficiency of access requests.

Method used

When receiving access requests, the target server is reasonably allocated according to the load distribution of the sending device and server cluster to ensure load balancing of each server. The target request link is determined by using the load list and cost price calculation, and the ATOMIC_INTEGE flag is used to ensure that the access request is completed on the same server.

Benefits of technology

It achieves load balancing across the server cluster, ensuring that each server is fully utilized and improving the response efficiency and integrity of access requests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114003337B_ABST
    Figure CN114003337B_ABST
Patent Text Reader

Abstract

The embodiment of the application discloses a kind of allocation method and device of access request, the method includes: receiving multiple access requests, the access request is used to request execution target service;According to the sending device of each access request in multiple access requests and / or server load distribution in server cluster, the target server of each access request is allocated, server cluster includes at least one server, at least one server includes target server;Each access request is sent to target server respectively.The application determines target server by the sending device of access request and / or the load distribution of server, can be complete response while guaranteeing access request also can reasonably allocate the server in server cluster, so that each server in server cluster can be fully utilized, and the load distribution of server cluster is balanced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of communication technology, and in particular to a method and device for distributing access requests. BACKGROUND

[0002] With the development of network technology, the number of users accessing the background server of a website or a platform providing network services increases with the increasing business of the website or the platform. Therefore, the website or the background server is usually provided with a service cluster structure to provide access services for users. However, when a large number of users access the server cluster, the following phenomenon may occur: the access request sent by a user may need to call multiple servers, and in order to ensure that the access request can be completely responded, the operation logic between the server and other servers still needs to be executed by the server before the access request is completed. Therefore, a server in the server cluster may be overloaded due to too many clients connected thereto, while other servers in the server cluster are idle. SUMMARY

[0003] Embodiments of the present application provide a method and device for distributing access requests, which can reasonably distribute servers in a server cluster while ensuring that access requests are completely responded, so that each server in the server cluster can be fully utilized, and load distribution of the server cluster is balanced.

[0004] In a first aspect, a method for distributing access requests is provided, and the method comprises the following steps:

[0005] receiving a plurality of access requests, wherein the access requests are used to request to execute target services;

[0006] distributing target servers for each access request in the plurality of access requests according to a sending device of the each access request and / or a load distribution of servers in a server cluster, wherein the server cluster comprises at least one server, and the at least one server comprises the target servers;

[0007] sending the each access request to the target servers respectively.

[0008] In a second aspect, a device for distributing access requests is provided, and the device comprises a processing unit and a transceiver unit, wherein:

[0009] the transceiver unit is configured to receive a plurality of access requests, wherein the access requests are used to request to execute target services;

[0010] a processing unit, configured to allocate a target server for each of the plurality of access requests according to a sending device of the each of the plurality of access requests and / or a server load distribution in a server cluster, the server cluster comprising at least one server, the at least one server comprising the target server;

[0011] the transceiving unit is further configured to send the each of the plurality of access requests to the target server respectively.

[0012] In a third aspect, an embodiment of the present application provides a server, comprising a processor, a memory, a communication interface, and one or more programs, the one or more programs are stored in the memory and configured to be executed by the processor, and the program comprises instructions for performing part or all of the steps described in the method of the first aspect.

[0013] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium storing a computer program for electronic data exchange, wherein the computer program causes a computer to perform part or all of the steps described in the method of the first aspect.

[0014] In a fifth aspect, an embodiment of the present application provides a computer program product, wherein the above computer program product includes a non-transitory computer readable storage medium storing a computer program, and the computer program is operable to cause a computer to perform part or all of the steps described in the method of the first aspect of the present application. The computer program product can be a software installation package.

[0015] The technical solution provided by the present application receives a plurality of access requests, the access request is used to request to execute a target service; according to the sending device of each of the plurality of access requests and / or the server load distribution in a server cluster, the target server for each of the plurality of access requests is allocated, the server cluster comprises at least one server, the at least one server comprises the target server; each of the plurality of access requests is sent to the target server respectively. The present application determines the target server through the load distribution of the sending device of the access request and / or the server, can guarantee that the access request is completely responded while also reasonably allocating the servers in the server cluster, so that each server in the server cluster can be fully utilized, and the load distribution of the server cluster is balanced. BRIEF DESCRIPTION OF DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. Obviously, the drawings described in the following embodiments are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort based on these drawings.

[0017] Figure 1 is a system architecture schematic diagram provided by an embodiment of the present application;

[0018] Figure 2 is a flow schematic diagram of an access request allocation method provided by an embodiment of the present application;

[0019] Figure 3 is a schematic diagram of responding to an access request provided by an embodiment of the present application;

[0020] Figure 4 is a functional unit component block diagram of an access request allocation apparatus provided by an embodiment of the present application;

[0021] Figure 5 is a structural schematic diagram of another server provided by an embodiment of the present application. DETAILED DESCRIPTION

[0022] In order for those skilled in the art to better understand the technical solutions of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments. Based on the description of the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative effort fall within the scope of the present application.

[0023] The terms "first", "second", and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, software, product or device including a series of steps or units is not limited to the listed steps or units, but also includes steps or units not listed or other steps or units inherent to the process, method, product or device.

[0024] Reference to an "embodiment" herein means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase that the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive of one another. As will be apparent to those of ordinary skill in the art, embodiments described herein can be combined with other embodiments.

[0025] Referring to Figure 1 , Figure 1 is a system architecture schematic diagram provided by an embodiment of the application, as Figure 1 shown, the system architecture to which the embodiments of the application are applicable includes a user device 110 and a server cluster 120, which can include multiple servers, such as the servers 121, 122, and 123 shown in Figure 1 The user device 110 can communicate with the servers 121, 122, and 123 through a network, for example, the user device sends an access request to any of the servers 121, 122, and 123 to perform a target service. When the target service requested by the access request needs to call multiple servers, the server receiving the access request can interact with other servers according to the access request.

[0026] Referring to Figure 2 , Figure 2 is a flowchart of an access request allocation method provided by an embodiment of the application, which is applied to any server as shown in Figure 1 As shown in Figure 2 , the method includes the following steps.

[0027] S210, receiving multiple access requests, the access requests being used to request to perform target services.

[0028] When a user needs to obtain a service due to business needs, the user can send an access request to a server in a server cluster through a client. After receiving each request, the server can determine the steps to be performed according to the target service requested by the request, and then determine other servers according to the steps to be performed.

[0029] S220, according to the sending device of each access request in the multiple access requests and / or the load distribution of the servers in the server cluster, allocating a target server for the each access request, the server cluster including at least one server, the at least one server including the target server.

[0030] The client can be a smart phone, a personal computer, or the like smart terminal, and the server in the server cluster can be a front-end connection server in the server cluster and / or a back-end server in the server cluster. Taking the front-end connection server cluster as an example, when a user logs in through the client, the client of the user can send a login request to a server closest to the client in the front-end server cluster. The closest server can query the load distribution of the servers in the front-end server cluster and the functions served by the servers in the front-end database after receiving the login request, to determine a request link suitable for serving the login request, and then forward the login request to a target server. The target server returns a request result to the back-end server after receiving the request, and the back-end server queries whether the account and the password carried in the login request are correct, and then returns the request result.

[0031] Optionally, the method further includes: if the sending device of the first access request is a client, obtaining a load list of the server cluster, the load list including at least one server with a load distribution less than or equal to a load threshold; determining a target request link of the first access request according to the load list, the target request link including the target server; and establishing a mapping relationship between the target request link and the first identifier.

[0032] In the present application, the load distribution of the server can include the number of established links of each server. In which, the resource consumption degree of each client is the same in the case of large data, so the number of established communication links of the server can reflect the current load distribution of the server. When receiving the connection information sent by the server, the number of established communication links of the server can be increased by 1, and the connection information can include the name of the server and the process identifier of the server establishing the connection; when receiving the disconnection information sent by the server, the number of established links of the server can be reduced by 1, and the disconnection information can include the name of the server and the process identifier of the server disconnecting the connection.

[0033] In which, a load list can be stored in the database, and the load list can include servers meeting the load requirement. When the current load of a server rises and reaches the load threshold, the server can be deleted from the servers meeting the load requirement (i.e. the load list); when the current load of a server decreases and is lower than the load threshold, the server can be added to the servers meeting the load requirement (i.e. the load list).

[0034] Optionally, the determining the target request link of the first access request according to the load list comprises: determining a service list called by the target service, the service list comprising n sub-services, the n being a positive integer; selecting a server capable of executing the sub-service from the load list, and forming a candidate request link by each sub-service corresponding to one server, to obtain a plurality of candidate request links; calculating a cost price of each candidate request link in the plurality of candidate request links, and determining the target request link according to the cost price.

[0035] In actual application, when implementing a business service, a business service comprises a plurality of sub-services, and each sub-service needs to call one or more servers, so that one access request can need to call a plurality of servers in sequence to be executed completely. Therefore, when receiving an access request sent by a client, the server can distribute an appropriate request link for the access request according to the load distribution of the server cluster, to realize the load distribution balance of the server cluster.

[0036] For example, when receiving an access request sent by a client, the server can obtain a load list from a database, select a server capable of implementing a sub-service from the load list, form a candidate request link by each sub-service corresponding to one server, to obtain a plurality of candidate request links, each of which can complete the target service requested by the access request. Then, a cost price of each candidate request link is calculated, which can be represented by the load distribution of each server and the transmission delay of each server in the candidate request link, and can be specifically represented as: wherein a and b are weight coefficients of the load distribution and the transmission delay respectively, the a and b are positive numbers, the p i is the number of established links of the i th server in the candidate request link, and the q i is the time from sending the access request to receiving the response of the i th server in the candidate request link. Finally, the candidate request link with the minimum cost price is selected from the plurality of candidate request links as the target request link.

[0037] For example, if the server receiving the access request sent by the client is in the load list, the candidate request link containing the server is preferentially determined as the target request link, that is, the priority of the candidate request link containing the server receiving the access request is the highest.

[0038] For example, assume that servers that can execute A service are A1, A2 and A3, servers that can execute B service are B1, B2 and B3, and a server that can execute C service is C, and a user equipment A sends an access request to request execution of a login service, which needs to sequentially call A service, B service and C service. Therefore, the calling order of the access request is A service -> B service -> C service, and candidate request links thereof can include A1-B1-C, A1-B2-C, A1-B3-C, A2-B1-C, A2-B2-C, A2-B3-C, A3-B1-C, A3-B2-C, A3-B3-C, wherein the number of links that have established connections for A1, A2, A3, B1, B2 and B3 is 3, 4, 6, 1, 4 and 2 respectively, and the transmission delay of A1-B1, A1-B2, A1-B3, A2-B1, A2-B2, A2-B3, A3-B1, A3-B2 and A3-B3 is 0.1, 0.15, 0.1, 0.2, 0.25, 0.1, 0.13, 0.21 and 0.15 respectively, and in the case that a takes 0.8 and b takes 0.2, it is calculated that the candidate request link with the minimum cost price is A1-B1-C, and therefore A1-B1-C is determined as the target request link.

[0039] Optionally, the determining the target request link according to the cost price comprises: obtaining a user level of the client and a service level of the target service; determining a priority level of the access request according to the user level and the service level; calculating a mean value and a variance of the cost prices of the multiple candidate request links; performing level division on the multiple candidate request links according to the mean value and the variance to obtain multiple candidate link groups, each candidate link group including at least one candidate request link; determining a target link group from the multiple candidate link groups, the target link group having a mapping relationship with the priority level of the access request; and determining any candidate request link in the target link group as the target request link.

[0040] In actual application, different services have different priority levels, and users also have different priority levels, in order to enable services requested by high-priority users or high-priority services to be responded as soon as possible, the server can determine the target request link of the access request according to the user level of the client and / or the service level of the target service.

[0041] Specifically, the server can pre-store a service level corresponding to each service, when receiving an access request sent by a client, the server can obtain a user level of the client and a service level of a target service requested by the access request. Then, a priority level of the access request is calculated, and the calculation formula of the priority level can be represented as wherein w is the user level, and the For the service level, c is a constant.

[0042] Further, in order to equally divide the plurality of candidate request links, an average value and a variance of cost prices of the plurality of candidate request links are calculated, a range of levels of the access request is determined according to the average value and the variance, the plurality of candidate request links are divided into a plurality of levels according to a mapping relationship between the variance and the level division mode, a plurality of candidate link groups are obtained, each level corresponds to a candidate link group, each candidate link group includes at least one candidate request link, a first difference value between the average value and the cost price of the access request is calculated, a target level corresponding to the first difference value is determined according to a mapping relationship between the difference value and the level, and a candidate link group corresponding to the target level is determined as a target link group. Then, in order to balance the load distribution of the server, a candidate request link is randomly selected from the target link group as a target request link.

[0043] In the present application, a server can receive access requests from different sending devices, the server receiving the access requests can uniformly intercept the access requests through a Spring interceptor, and then distinguish the access request mode. When the access request comes from a client, the server needs to allocate a suitable target server for the access request to execute a target service according to the service requested by the access request and the load request of the current server cluster; when the access request comes from other servers in the server cluster, the server interacts with the next server on the request link.

[0044] Optionally, the target server of each access request is allocated according to the sending device of each access request in the plurality of access requests and / or the load distribution of the servers in the server cluster, including: if the sending device of a first access request is a client, a first identifier is allocated to the first access request, and a server satisfying a load requirement in the server cluster is determined as the target server, the plurality of access requests include the first access request, and the first identifier is a process identifier of the target service newly created; if the sending device of the first access request is a server, a second identifier of the first access request is obtained, and a server corresponding to the second identifier is determined as the target server according to a mapping relationship between the identifier and the server, and the second identifier is a process identifier of the target service.

[0045] Specifically, when the server receives a new access request, the server can assign a target server to the client according to the distribution of the current server cluster, so that each server in the server cluster can be fully utilized, and the load distribution of the server cluster is balanced. Further, the server can also assign a new identifier ATOMIC_INTEGE to the new access request, which has atomicity, so that other servers receive the identifier as a load balancing strategy, ensure that the access request sent by the client has the same identifier between servers, so that the request sent by the execution target service can be hit on a server, thereby ensuring that the access request is completely responded. When the server receives an access request sent by other servers, since the call between servers will maintain an identifier ATOMIC_INTEGE on the request header, the target process of the access request can be determined through the identifier ATOMIC_INTEGE, and then the next target server on the request link can be determined according to the target process.

[0046] For example, as Figure 3As shown, the servers that can execute the A service are A1, A2 and A3, the servers that can execute the B service are B1, B2 and B3, and the server that can execute the C service is C. When the user equipment A sends an access request to request execution of the A service, the request link of the access request is A service -> B service -> C service. When the server A1, the server B1 and the server C meet the load requirement of the access request, the access request sent by the client can be sent to the server A1. After the server A1 receives the access request, the server A1 needs to call the B service, and three steps are required for the server A1 to call the B service. Therefore, after the server A1 receives the access request, the server A1 can initiate a request to the server B1 that has the B service. When the request of the server A1 hits the server B1, the other logics before the incoming request is completed need to hit the server B1, that is, the access request 1, the access request 2 and the access request 3 sent by the server A1 need to be initiated to the server B1. Further, the server B1 needs to call the C service, and two steps are required for the server B1 to call the C service. Therefore, after the server B1 receives the data request of the server A1, the server B1 can initiate a request to the server C that has the C service. Similarly, when the request of the server B1 hits the server C, the other logics before the incoming request is completed need to hit the server C, that is, the access request 1 and the access request 2 sent by the server B1 need to be initiated to the server C. When the server A1 receives the response of the server B1 to the access request 3, the access request is completed, and then the server A1 sends the execution result to the user equipment, so that in a single system architecture, one access request can also hit the same server to ensure that the access request is completely responded.

[0047] For another example, when the server A1, the server B2 and the server C meet the load requirement of the access request, the access request sent by the client can be sent to the server A1. After the server A1 receives the access request, the server A1 needs to call the B service. The server A1 sends the access request 1, the access request 2 and the access request 3 to the server B2 in sequence. After the server B2 receives the access request sent by the server A1, the server B2 needs to call the C service and sends the access request 1 and the access request 2 to the server C in sequence.

[0048] For another example, when the server A3, the server B3 and the server C meet the load requirement of the access request, the access request sent by the client can be sent to the server A3. After the server A3 receives the access request, the server A3 needs to call the B service. The server A3 sends the access request 1, the access request 2 and the access request 3 to the server B3 in sequence. After the server B3 receives the access request sent by the server A3, the server B3 needs to call the C service and sends the access request 1 and the access request 2 to the server C in sequence.

[0049] Optionally, the method further comprises: if the sending device of the first access request is a server, obtaining a first value of the first access request, the first value being used to indicate a logical execution order of the first access request in the target service; and performing a first operation on the first value.

[0050] The first operation is an increment operation, and interaction between servers maintains an ATOMIC_INTEGER identifier to ensure that multiple requests for the same target service are processed on the same server. The server sends an access request carrying a first value, which is used to indicate the logical execution order of the server in the target service. When the server receives an access request with the same ATOMIC_INTEGER identifier during execution of the target service, the server can perform an increment operation on the first value to ensure that the access request is not repeatedly received. For example, Figure 3 Access request 1, access request 2, and access request 3 in the target service all need to be processed on server B1, and the first values of access request 1, access request 2, and access request 3 are sequentially incremented.

[0051] S230, sending each access request to the target server.

[0052] In the embodiments of the present application, after the access request is determined, the access request is sent to the target server, so that the target server processes the access request to provide the target service.

[0053] Optionally, the method further comprises: obtaining first information of the client, the first information including the number of access requests sent within a first time length and the target service corresponding to each access request; updating a list of information of interest according to the first information, the list of information of interest including at least one target service with an interest degree greater than a preset value; obtaining a first data set from the server cluster, the first data set including data corresponding to the target service in the list of information of interest; and sending the first data set to the client.

[0054] Some service platforms or websites will launch some activities or content recommendations to users, so that users participate or browse to improve user retention rate. Therefore, the server can maintain a list of information of interest of the user, which can include services of interest (i.e., frequently requested services) of the user, and can be updated in real time. Specifically, the number of requests sent by the client within a preset time and the target service requested are counted, and the target service whose request number exceeds the preset value is considered to be a service of greater interest of the user, so that the target service is added to the list of information of interest, and the target service of interest in the list of information of interest less than or equal to the preset value is deleted, so that the list of interest stores the services of interest of the user in real time.

[0055] It can be seen that the present application provides a method for distributing access requests, receiving a plurality of access requests, the access request being used to request to execute a target service; distributing a target server of each access request according to a sending device of each access request and / or a load distribution of servers in a server cluster, the server cluster comprising at least one server, the at least one server comprising the target server; and sending each access request to the target server. The present application determines the target server by the sending device of the access request and / or the load distribution of the server, which can reasonably distribute the servers in the server cluster while ensuring that the access request is completely responded, so that each server in the server cluster can be fully utilized, and the load distribution of the server cluster is balanced.

[0056] The above mainly introduces the scheme of the embodiments of the present application from the perspective of the execution process of the method. It can be understood that the network device comprises a hardware structure and / or a software module corresponding to the execution of each function in order to implement the above functions. Those skilled in the art should easily realize that, in combination with the unit and algorithm steps of each example described in the embodiments provided herein, the present application can be realized in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0057] Please refer to Figure 4 , Figure 4 is a functional unit composition block diagram of an access request distribution device 400 provided by the embodiments of the present application. The device 400 comprises a transceiver unit 410 and a processing unit 420, wherein,

[0058] The transceiver unit 410 is configured to receive a plurality of access requests, the access request being used to request to execute a target service;

[0059] the processing unit 420 is configured to assign a target server for each access request in the plurality of access requests according to a load distribution of a sending device of the each access request and / or servers in a server cluster, the server cluster comprising at least one server, the at least one server comprising the target server;

[0060] the transceiver 410 is further configured to send the each access request to the target server respectively.

[0061] Optionally, in the assigning of the target server for each access request in the plurality of access requests according to the load distribution of the sending device of the each access request and / or the servers in the server cluster, the processing unit 420 is specifically configured to: if a sending device of a first access request is a client, assign a first identifier to the first access request, and determine a server satisfying a load requirement from the server cluster as the target server, the plurality of access requests comprising the first access request, the first identifier being a newly created process identifier of the target service; if the sending device of the first access request is a server, obtain a second identifier of the first access request, and determine a server corresponding to the second identifier as the target server according to a mapping relationship between identifiers and servers, the second identifier being a process identifier of the target service.

[0062] Optionally, the processing unit 420 is further configured to, if the sending device of the first access request is the server, obtain a first value of the first access request, the first value being used to indicate a logical execution order of the first access request in the target service; and perform a first operation on the first value.

[0063] Optionally, the processing unit 420 is further configured to, if the sending device of the first access request is the client, obtain a load list of the server cluster, the load list comprising at least one server with a load distribution less than or equal to a load threshold; determine a target request link of the first access request according to the load list, the target request link comprising the target server; and establish a mapping relationship between the target request link and the first identifier.

[0064] Optionally, in terms of determining the target request link of the first access request according to the load list, the processing unit 420 is specifically configured to: determine a service list called by the target service, the service list including n sub-services, the n being a positive integer; select a server capable of executing the sub-service from the load list, and form a candidate request link by combining each sub-service with a corresponding server, to obtain a plurality of candidate request links; calculate a cost price of each candidate request link in the plurality of candidate request links, and determine the target request link according to the cost price.

[0065] Optionally, in terms of determining the target request link according to the cost price, the processing unit 420 is specifically configured to: obtain a user level of the client and a service level of the target service; determine a priority level of the access request according to the user level and the service level; calculate a mean value and a variance of the cost prices of the plurality of candidate request links; divide the plurality of candidate request links into a plurality of candidate link groups according to the mean value and the variance, each candidate link group including at least one candidate request link; determine a target link group from the plurality of candidate link groups, the target link group having a mapping relationship with the priority level of the access request; and determine any candidate request link in the target link group as the target request link.

[0066] Optionally, the processing unit 420 is further configured to obtain first information of the client, the first information including a number of the access requests sent within a first time length and a target service corresponding to each of the access requests; update a list of information of interest according to the first information, the list of information of interest including at least one target service having an interest degree greater than a preset value; and obtain a first data set from the server cluster, the first data set including data corresponding to the target services in the list of information of interest.

[0067] The transceiver unit 410 is further configured to send the first data set to the client.

[0068] It should be understood that the apparatus 400 herein is embodied in the form of functional units. The term "unit" herein can refer to an application specific integrated circuit (ASIC), an electronic circuit, a processor (for example, a shared processor, a dedicated processor, or a group processor, etc.) and a memory for executing one or more software or firmware programs, a combination of logic circuitry and / or other suitable components that support the described functions. In an optional example, those skilled in the art can understand that the apparatus 400 can be embodied in the server in the above-mentioned embodiments, and the apparatus 400 can be used to execute the respective processes and / or steps corresponding to the server in the above-mentioned method embodiments. To avoid repetition, details are not described here.

[0069] The apparatus 400 of each of the above-mentioned schemes has a function of implementing the corresponding steps performed by the server in the above-mentioned methods; the function can be implemented by hardware, or implemented by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-mentioned functions; for example, the transceiver unit 410 can be replaced by a transmitter, and the processing unit 420 can be replaced by a processor, which respectively perform the transceiving operations and the related processing operations in each of the method embodiments.

[0070] In the embodiments of the present application, the apparatus 400 can also be a chip or a chip system, for example, a system on chip (SoC). Correspondingly, the transceiver unit can be a transceiver circuit of the chip, which is not limited here.

[0071] Please refer to Figure 5 , Figure 5 is a structural schematic diagram of a server provided by the embodiments of the present application, which includes one or more processors, one or more memories, one or more communication interfaces, and one or more programs; the one or more programs are stored in the memory and configured to be executed by the one or more processors.

[0072] The above-mentioned program includes instructions for executing the following steps:

[0073] Receiving a plurality of access requests, the access requests being used to request to execute target services;

[0074] According to the sending device of each access request in the plurality of access requests and / or the load distribution of the servers in a server cluster, allocating a target server for the each access request, the server cluster including at least one server, the at least one server including the target server;

[0075] Respectively sending the each access request to the target server.

[0076] All the related content of each scenario involved in the method embodiments can be cited to the function description of the corresponding function module, and will not be repeated here.

[0077] It should be understood that the above memory can include read-only memory and random access memory, and provide instructions and data to the processor. A portion of the memory can also include non-volatile random access memory. For example, the memory can also store device type information.

[0078] In the embodiments of the present application, the processor of the above device can be a central processing unit (CPU), and the processor can also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0079] It should be understood that "at least one" in the embodiments of the present application refers to one or more, and "multiple" refers to two or more. The "and / or" describes the association relationship of the associated objects, which means that there can be three kinds of relationships, for example, A and / or B can represent: A exists alone, A and B exist together, and B exists alone, where A and B can be singular or plural. The character " / " generally represents that the associated objects before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single item or multiple items. For example, at least one of a, b, or c can represent: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, and c can be single or multiple.

[0080] In addition, unless otherwise stated, the ordinal numbers "first", "second", etc. mentioned in the embodiments of the present application are used to distinguish a plurality of objects, and are not used to limit the order, time sequence, priority or importance of the plurality of objects. For example, the first information and the second information are only used to distinguish different information, and do not mean that the contents, priority, sending order or importance of the two kinds of information are different.

[0081] In the implementation process, the steps of the foregoing method can be completed by integrated logic circuits of hardware in the processor or instructions in the form of software. The steps of the method disclosed by the embodiments of the present application can be directly embodied as execution completed by a hardware processor, or executed by a combination of hardware and software units in the processor. The software unit can be located in a mature storage medium in the field, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, or the like. The storage medium is located in the memory, and the processor executes the instructions in the memory to complete the steps of the foregoing method in combination with the hardware thereof. To avoid repetition, no further detailed description is given here.

[0082] The embodiments of the present application further provide a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program causes a computer to execute part or all of the steps of any method described in the foregoing method embodiments.

[0083] The embodiments of the present application further provide a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute part or all of the steps of any method described in the foregoing method embodiments. The computer program product can be a software installation package.

[0084] It should be noted that, for each of the foregoing method embodiments, in order to simply describe, each is described as a combination of a series of actions, but those skilled in the art should know that the present application is not limited to the order of the actions described, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0085] In the foregoing embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.

[0086] In the several embodiments provided by the present application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are only schematic. The division of the foregoing units is only a logical function division. There can be another division manner for actual implementation, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical or other forms.

[0087] The units described as separate components above can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiments of the present application.

[0088] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0089] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a TRP, etc.) to execute all or part of the steps of the methods of the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.

[0090] Those of ordinary skill in the art can understand that all or part of the steps of the various methods of the above embodiments can be completed by program instructions related to hardware, and the program can be stored in a computer readable storage medium, which can include a flash disk, a ROM, a RAM, a magnetic disk or an optical disk, etc.

[0091] The embodiments of the present application are described in detail above, and the specific examples are applied to the principles and implementation modes of the present application. The above description of the embodiments is only to help understand the method of the present application and its core idea; at the same time, for those skilled in the art, according to the idea of the present application, the specific implementation mode and application range will be changed; in view of the above, the content of the specification should not be understood as a limitation of the present application.

Claims

1. A method of allocating access requests, characterized by, The method comprises: receiving a plurality of access requests, the access requests being used to request execution of a target service; allocating a target server for each access request in the plurality of access requests according to a sending device of the each access request and / or a server load distribution in a server cluster, the server cluster comprising at least one server, the at least one server comprising the target server; sending the each access request to the target server respectively; the allocating of the target server for the each access request according to the sending device of the each access request and / or the server load distribution in the server cluster comprises: if a sending device of a first access request is a client, allocating a first identifier to the first access request, and determining a server satisfying a load requirement from the server cluster as the target server, the plurality of access requests comprising the first access request, the first identifier being a process identifier of the target service newly created; if the sending device of the first access request is a server, obtaining a second identifier of the first access request, and determining a server corresponding to the second identifier as the target server according to a mapping relationship between an identifier and a server, the second identifier being a process identifier of the target service, and a next target server on a request link being determined according to a target process; When receiving the access request sent by the client, a load list is obtained from the database, servers that can implement sub-services are selected from the load list, each sub-service corresponds to a server to form a candidate request link, a plurality of candidate request links are obtained, each candidate request link can complete the target service requested by the access request; then, a cost price of each candidate request link is calculated, the cost price is represented by load distribution of each server and transmission delay of each server in the candidate request link, and is specifically represented as: wherein a and b are weight coefficients of the load distribution and the transmission delay respectively, a and b are positive numbers, p i is the number of established connections of the i th server in the candidate request link, q i is the time from sending the access request to receiving the response of the i th server in the candidate request link; finally, a selected request link with the minimum cost price is determined as a target request link from the plurality of candidate request links.

2. The method of claim 1, wherein, the method further comprises: if the sending device of the first access request is the server, obtaining a first value of the first access request, the first value being used to indicate a logical execution order of the first access request in the target service; performing a first operation on the first value.

3. The method of claim 1, wherein, the method further comprises: if the sending device of the first access request is the client, obtaining a load list of the server cluster, the load list comprising at least one server with a load distribution less than or equal to a load threshold; determining a target request link of the first access request according to the load list, the target request link comprising the target server; establishing a mapping relationship between the target request link and the first identifier.

4. The method of claim 3, wherein, the determining of the target request link of the first access request according to the load list comprises: determining a service list called by the target service, the service list comprising n sub-services, the n being a positive integer; selecting servers capable of executing the sub-services from the load list, and forming a candidate request link by each sub-service corresponding to one server, to obtain a plurality of candidate request links; calculating a cost price of each candidate request link in the plurality of candidate request links, and determining the target request link according to the cost price.

5. The method of claim 4, wherein, the determining of the target request link according to the cost price comprises: obtaining a user level of the client and a business level of the target service; determining a priority level of the access request according to the user level and the business level; calculating a mean value and a variance of the cost prices of the plurality of candidate request links; dividing the plurality of candidate request links into a plurality of candidate link groups according to the mean value and the variance, each candidate link group comprising at least one candidate request link; determining a target link group from the plurality of candidate link groups, a level of the target link group being mapped to a priority level of the access request; determining any candidate request link in the target link group as the target request link.

6. The method of claim 1, wherein, The method further comprises: obtaining first information of the client, the first information comprising a number of the access requests sent within a first time length and a target service corresponding to each of the access requests; updating a list of information of interest according to the first information, the list of information of interest comprising at least one target service with an interest degree greater than a preset value; obtaining a first data set from the server cluster, the first data set comprising data corresponding to the target service in the list of information of interest; sending the first data set to the client.

7. An apparatus for allocating an access request, the apparatus comprising: a transceiver configured to receive a plurality of access requests, the access requests being used to request execution of a target service; a processor configured to allocate a target server for each of the access requests according to a sending device of the each of the access requests and / or a load distribution of servers in a server cluster, the server cluster comprising at least one server, the at least one server comprising the target server; the transceiver is further configured to send the each of the access requests to the target server respectively; the processor is specifically configured to, if a sending device of a first access request is a client, allocate a first identifier to the first access request and determine a server satisfying a load requirement from the server cluster as the target server, the plurality of access requests comprising the first access request, the first identifier being a process identifier of the target service newly created; if the sending device of the first access request is a server, obtain a second identifier of the first access request and determine a server corresponding to the second identifier as the target server according to a mapping relationship between an identifier and a server, the second identifier being a process identifier of the target service; determining a next target server on a request link according to a target process; The device is used to obtain a load list from a database when receiving an access request sent by a client, select servers that can implement sub-services from the load list, form a candidate request link for each sub-service corresponding to a server, obtain multiple candidate request links, and complete a target service requested by the access request for each candidate request link. Then, a cost price of each candidate request link is calculated, which is represented by load distribution of each server and transmission delay of each server in the candidate request link, and is specifically represented as: Wherein a and b are weight coefficients of load distribution and transmission delay, respectively, a and b are positive numbers, p i is the number of established links of the i-th server in the candidate request link, q i is the time from sending the access request to receiving the response of the i-th server in the candidate request link. finally determining a selected request link with a minimum cost price from the plurality of candidate request links as a target request link.

8. A server, characterized by The server comprises a processor, a memory and a communication interface, the memory stores one or more programs, and the one or more programs are executed by the processor, the one or more programs comprising instructions for performing steps in the method of any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program for electronic data exchange, wherein the computer program causes a computer to perform steps of the method of any one of claims 1-6.

Citation Information

Patent Citations

  • Access control method and device

    CN108173937A

  • Distributed load balancing method and device

    CN110650195A