CN112667396A - Access request processing method, device and system - Google Patents

Access request processing method, device and system Download PDF

Info

Publication number
CN112667396A
CN112667396A CN202011551989.7A CN202011551989A CN112667396A CN 112667396 A CN112667396 A CN 112667396A CN 202011551989 A CN202011551989 A CN 202011551989A CN 112667396 A CN112667396 A CN 112667396A
Authority
CN
China
Prior art keywords
service
access request
data
instance data
server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011551989.7A
Other languages
Chinese (zh)
Other versions
CN112667396B (en
Inventor
张国妍
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century 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 QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202011551989.7A priority Critical patent/CN112667396B/en
Publication of CN112667396A publication Critical patent/CN112667396A/en
Application granted granted Critical
Publication of CN112667396B publication Critical patent/CN112667396B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The technical scheme includes that service relation data are cached in advance, when the associated service is called, instance data of the associated service are inquired from the cached service relation data, and an access request is directly forwarded to a server corresponding to the instance data. Therefore, the service center does not need to be visited to obtain the instance data corresponding to the service every time, the communication times between the load balancing device and the service center can be greatly reduced, the processing time delay of the service calling request is reduced, and the timeliness of the service calling is improved.

Description

Access request processing method, device and system
Technical Field
The present application relates to the field of distributed data storage technologies, and in particular, to a method, an apparatus, and a system for processing an access request.
Background
With the increasing scale of internet applications, the distribution of services is in a clustering and centralized development, that is, multiple services are provided simultaneously through a server Cluster (Cluster) including multiple servers. Different services may have more than one instance, i.e. multiple servers providing the same service, due to different traffic complexity or traffic volume. In the service calling process, the load balancing device requests the instance data of the called service from the service center according to a service calling request sent from the outside, and the service calling request is routed to the instance of the called service according to a certain strategy.
When a large number of services are provided in a service cluster and the services are frequently inter-modulated, the load balancing device needs to frequently request the service center for instance data of each service, so that the communication pressure between the load balancing device and the service is increased, the processing delay of the service call request is increased, and the timeliness of the service call is affected.
Disclosure of Invention
In order to solve the technical problem or at least partially solve the technical problem, the application provides an access request processing method, device and system.
In one aspect, the present application provides an access request processing method, including:
determining a first service corresponding to a first access request, and acquiring first instance data corresponding to the first service;
sending the first access request to a first server corresponding to the first instance data;
when a second access request for accessing a second service from the first server is received, second instance data corresponding to the second service is obtained by inquiring from a cached service relation data set, wherein the service relation data set comprises the second service related to the first service and the second instance data corresponding to the second service;
determining that the second access request corresponds to a second server according to the second instance data;
sending the second access request to the second server.
Optionally, the determining a first service corresponding to the first access request, and acquiring first instance data corresponding to the first service includes:
extracting first attribute information from the first access request;
determining a first service corresponding to the first access request according to the first attribute information;
querying at least one second service associated with the first service according to the first attribute information;
acquiring first service relation data of the first service and the second service, wherein the first service relation data comprises first instance data corresponding to the first service and second instance data corresponding to the second service;
caching the first service relationship data into the service relationship data set.
Optionally, the querying, from the cached service relationship data, the instance data corresponding to the second service includes:
obtaining a cache validity period corresponding to the service relation data containing the second service;
and when the current time is determined to be within the caching validity period, extracting the instance data corresponding to the second service from the service relation data containing the second service.
Optionally, the caching the first service relationship data into the service relationship data set includes:
obtaining an access index between the first service and the second service, the access index including: access frequency and/or access time;
caching the first service relationship data into the service relationship data set when the access index meets a first preset condition;
wherein, the access frequency meeting a first preset condition comprises: the access frequency is greater than or equal to a first value; the access time meeting a first preset condition comprises the following steps: the time interval between the access time and the current time is less than or equal to a preset time interval.
Optionally, the caching the first service relationship data into the service relationship data set includes:
and when the number of the data in the service relationship data set is smaller than a preset number and/or the data volume of the service relationship data set is smaller than a preset capacity, caching the first service relationship data into the service relationship data set.
In another aspect, the present application provides an access request processing apparatus, including:
the acquisition module is used for determining a first service corresponding to a first access request and acquiring first instance data corresponding to the first service;
the transmission module is used for sending the first access request to a first server corresponding to the first instance data;
the query module is configured to, when the transmission module receives a second access request for accessing a second service from the first server, query from a cached service relationship data set to obtain second instance data corresponding to the second service, where the service relationship data set includes the second service associated with the first service and the second instance data corresponding to the second service;
the determining module is used for determining that the second access request corresponds to a second server according to the example data;
the transmission module is configured to send the second access request to the second server.
Optionally, the obtaining module is configured to extract the first attribute information from the first access request; determining a first service corresponding to the first access request according to the first attribute information; querying at least one second service associated with the first service according to the first attribute information; acquiring first service relation data of the first service and the second service, wherein the first service relation data comprises first instance data corresponding to the first service and second instance data corresponding to the second service; caching the first service relationship data into the service relationship data set.
In another aspect, the present application provides an access request processing system, including: the system comprises a load balancing device, a service relation storage device and a service center;
the service relation storage device is used for storing service relation data among the associated services;
the service center is used for storing instance data corresponding to the service;
the load balancing device is used for receiving a first access request of a first service; extracting first attribute information from the first access request; in the service relation storage device, inquiring at least one second service associated with the first service according to the first attribute information; inquiring first service relation data of the first service and a second service from the service center, wherein the first service relation data comprises first instance data corresponding to the first service and second instance data corresponding to the second service; caching the first service relationship data into the service relationship data set;
the load balancing device is further configured to determine a first service corresponding to a first access request, and query, from the service relationship data set, first instance data corresponding to the first service; sending the first access request to a first server corresponding to the first instance data; when receiving a second access request for accessing a second service from the first server, the access request queries from the service relationship data set to obtain second instance data corresponding to the second service; determining that the second access request corresponds to a second server according to the second instance data; sending the second access request to the second server.
According to another aspect of an embodiment of the present application, there is provided an electronic device including: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the above method steps when executing the computer program.
According to another aspect of embodiments of the present application, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the above-mentioned method steps.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages:
in this embodiment, by caching the service relationship data in advance, when the associated service is called, instance data of the associated service is queried from the cached service relationship data, and the access request is directly forwarded to the server corresponding to the instance data. Therefore, the service center does not need to be visited to obtain the instance data corresponding to the service every time, the communication times between the load balancing device and the service center can be greatly reduced, the processing time delay of the service calling request is reduced, and the timeliness of the service calling is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a flowchart of an access request processing method according to an embodiment of the present application;
fig. 2 is a flowchart of an access request processing method according to another embodiment of the present application;
fig. 3 is a flowchart of an access request processing method according to another embodiment of the present application;
fig. 4 is a flowchart of an access request processing method according to another embodiment of the present application;
fig. 5 is an interaction flowchart of a method for processing an access request according to another embodiment of the present application;
fig. 6 is a block diagram of an access request processing apparatus according to an embodiment of the present application;
fig. 7 is a block diagram of an access request processing system according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
For a server cluster providing multiple services, there is a dependency call relationship between the services, for example, a commodity purchase service of a shopping application calls a transaction payment service, and so on. In the following embodiments of the present application, a service having a dependency call relationship is referred to as an association service.
In this embodiment, the instance data of the other service associated with the service requested by the user is loaded into the cache, so that when the other service needs to be accessed, the instance data of the service can be directly searched from the cache, and then the corresponding server is accessed, thereby improving the cache hit rate of the load balancing device, greatly reducing the number of times of communication between the load balancing device and the service center, reducing the processing delay of the service invocation request, and improving the timeliness of service invocation.
In addition, in order to ensure cache consistency, direct communication is required between the load balancing device and the service center, if the memory is always busy with cache transactions of the service instance data, other caches requiring communication must wait for communication (update access) of the service instance data cache before communication, and then cache jitter is generated, which reduces the performance of the whole server cluster. According to the scheme of the embodiment of the application, the communication times between the load balancing device and the service center are reduced, and the cache pressure of the memory on the instance data is reduced, so that the problem of cache jitter is avoided, and the performance of the whole server cluster is improved.
Wherein the Instance data (Instance) comprises: the Server address of the Server (Real Server, RS) that really provides the external service may be multiple servers that provide the same external service in the Server cluster, and thus, the instance data corresponding to the service may include multiple Server addresses.
First, the access request processing method according to the embodiment of the present application will be described in detail.
Fig. 1 is a flowchart of an access request processing method according to an embodiment of the present application. As shown in fig. 1, the method is applied to a load balancing device, and includes the following steps:
step S11, determining a first service corresponding to the first access request, and acquiring first instance data corresponding to the first service.
The first access request (RequestA) includes first attribute information corresponding to the first service (service a), such as a domain name, a path, and other information, and based on these information, the load balancing apparatus may identify the service a.
After identifying the service a, optionally, if the load balancing apparatus itself already caches the instance data (InstanceA) of the service a, the InstanceA of the service a may be directly obtained from the local cache. If the access request to the service a is received for the first time, and the load balancing device does not cache InstanceA, the access request may request InstanceA from the service center, or query the service relationship storage device for the associated service of the service a, and then obtain the instance data of the service a and the associated service from the service center. Wherein, InstanceA contains the address of the server that really provides the service a.
Step S12, the first access request is sent to the first server corresponding to the first instance data.
In this step, a first server (RS) corresponding to the service a may be determined according to InstanceAA) Address, thereby transmitting RequestA to RSA
Step S13, when a second access request for accessing the second service is received from the first server, obtaining second instance data corresponding to the second service by querying from the cached service relationship data set, where the service relationship data set includes the second service associated with the first service and the second instance data corresponding to the second service.
Because the services have a dependent call relationship, when a second service (service B) needs to be called in the process of using the service a, the RS1 sends a second access Request (Request2) to the service B to the load balancing apparatus, and the load balancing apparatus queries the locally cached service relationship data set, and because the service relationship data set stores in advance Instance data of other services related to the first service, the second Instance data (Instance2) corresponding to the service B can be searched from the service relationship data set.
Step S14, determining that the second access request corresponds to the second server according to the second instance data.
The location 2 contains the address of the server that actually provides the service B, and therefore, based on the location 2, it can be determined that the Request2 corresponds to the RSB.
Step S15, the second access request is sent to the second server.
In the above steps S11 to S15, by caching the service relationship data in advance, when the associated service is called, the instance data of the associated service is queried from the cached service relationship data, and the access request is directly forwarded to the server corresponding to the instance data. Therefore, the service center does not need to be visited to obtain the instance data corresponding to the service every time, the cache hit rate of the load balancing device is improved, the communication times between the load balancing device and the service center are greatly reduced, the processing delay of the service calling request is reduced, and the timeliness of the service calling is improved. Meanwhile, the communication frequency between the load balancing device and the service center is reduced, and the cache pressure of the memory on the instance data is reduced, so that the problem of cache jitter is avoided, and the performance of the whole server cluster is improved.
Fig. 2 is a flowchart of an access request processing method according to another embodiment of the present application. As shown in fig. 2, if the load balancing apparatus does not cache the instance data of the first service, step S11 includes the following steps:
in step S21, first attribute information is extracted from the first access request.
Wherein the first attribute information includes at least one of: domain name, path, request header, and query parameters. A Path refers to a relative Path of a resource.
In step S21, the first access request may be processed using a req object, such as by a req. Host, where a domain name (Host) in the first access request may be obtained; path, a path, such as a URI, in the first access request may be obtained; the header can obtain a request header in the first access request; query parameters in the first access request can be obtained through the query.
For example, for the request path "http:// test.com/location" in the first access request, the domain name (Host) is "test.com"; the path may be "/location".
For another example, if the request path is "http:// test. com/video/fun", the path may be "/vi deo/fun".
Step S22, determining a first service corresponding to the first access request according to the first attribute information.
Step S23, at least one second service associated with the first service is queried according to the first attribute information.
Step S24, obtain first service relationship data of the first service and the second service, where the first service relationship data includes first instance data corresponding to the first service and second instance data corresponding to the second service.
Step S25, caching the first service relationship data into the service relationship data set.
In the above steps S21 to S25, the load balancing server determines the service a to be accessed according to the information extracted from the access request, queries the service B, C associated with the service a from the service relationship storage device according to the attribute information of the service a, queries the instance data of the service A, B, C from the service center, and stores the service relationship data containing the association relationship between the services A, B, C and the instance data thereof into the service relationship data set local to the load balancing server. In this way, the load balancing apparatus obtains the instance data of the service B, C associated with the service a while obtaining the instance data of the service a, and calls the service B, C when the service a is used, so that the load balancing apparatus can directly query the instance data of the service B, C from the cached service relationship data set, and can further access the server corresponding to the service B, C.
In an alternative embodiment, when the second service is called, the service relationship data of the second service and other services may also be cached. Fig. 3 is a flowchart of an access request processing method according to another embodiment of the present application. As shown in fig. 3, the method further comprises:
step S41, acquiring second attribute information of the second service;
step S42, querying a third service associated with the second service according to the second attribute information;
step S43, when the service relation data containing the third service is not inquired from the service relation data set, acquiring second service relation data of the second service and the third service;
in step S44, the second service relationship data is cached in the service relationship data set.
For example, the load balancing appliance queries service C, D, E associated with service B from the service relationship storage, where the instance data for service C is already stored in the service relationship dataset and the instance data for service D, E is not in the service relationship dataset. Therefore, the load balancing apparatus may not acquire the instance data of the service C from the service center again, and may acquire only the instance data of the service D, E from the service center.
Through the steps S41 to S44, each time the load balancing device receives an access request, the load balancing device can cache the instance data of other services associated with the currently requested service, so that when other services need to be called, the instance data of the service can be directly searched from the cache, and then the corresponding server is accessed, thereby improving the cache hit rate of the load balancing device, greatly reducing the number of times of communication between the load balancing device and the service center, reducing the processing delay of the service call request, and improving the timeliness of service call; and the cache pressure of the memory on the instance data is reduced, so that the problem of cache jitter is avoided, and the performance of the whole server cluster is improved. In addition, when the instance data of the service is acquired, the cached instance data of the service is not acquired any more, so that the load balancing device is prevented from acquiring and storing repeated data, and the occupation of resources of the load balancing device is reduced.
In an alternative embodiment, the instance data of the service may include a plurality of server addresses, and the load balancing apparatus may randomly select one server address from the plurality of server addresses to access the server corresponding to the server address. However, there is a difference in performance between servers that provide services, and the number of service requests that can be received is also different, and in order to achieve load balancing based on server performance, a weight corresponding to each server address is added to the instance data. Fig. 4 is a flowchart of an access request processing method according to another embodiment of the present application, and as shown in fig. 4, the step S14 includes the following steps:
step S51, acquiring at least two server addresses in the second instance data and the corresponding weights of the server addresses;
step S52, determining a first server address corresponding to the second access request according to the weight;
in step S53, the server corresponding to the first server address is determined as the second server.
For example, the second example data corresponding to the service B includes two server addresses IP, PORT and a WEIGHT for each server address: 10.10.1.1:80:100, 10.10.1.2:80:200, i.e. the first server address 10.10.1.1:80 is weighted by 100 and the second server address 10.10.1.2:80 is weighted by 200. Based on the weight, the number of the servers RSB1 and RSB2 accepting requests per server address can be limited, if there are 90 access requests, 30 access requests are forwarded to RSB1, and 60 access requests are forwarded to RSB 2.
Specifically, the access requests corresponding to the second service may be sorted according to the access time, for example, the 1 st access request will be forwarded to the RSB1, and the 2 nd and 3 rd access requests will be forwarded to the RSB 2; or 1 ~ 10 access requests will be forwarded to RSB1, 11 ~ 30 access requests will be forwarded to RSB 2; and so on. The method for determining the server corresponding to the access request based on the weight is not limited to this, and many other methods are possible, which are not described herein again.
The above steps S51 to S53 are to determine the server corresponding to the access request based on the weight corresponding to each service address in the instance data, and the weight can limit the number of requests received by each server, thereby ensuring the stability of the server performance and improving the stability and reliability of the service provided by the server.
In an alternative embodiment, the step S15 includes: obtaining a cache validity period corresponding to the service relation data containing the second service; and when the current time is determined to be within the caching validity period, extracting the instance data corresponding to the second service from the service relation data containing the second service. And setting a caching validity period for the service relationship data, such as 1 minute, wherein if the caching validity period is within 1 minute, the load balancing device can hit the instance data of the second service, and if the caching validity period exceeds 1 minute, the load balancing device needs to obtain the instance data corresponding to the second service again. Therefore, firstly, the service relation data is ensured to be cached on the load balancing device for a period of time, so that the load balancing device can directly hit the example data in the time, the processing delay of the service request is reduced, and the cache hit rate is improved; and secondly, the excessive occupation of resources by the long-time storage of service relationship data by the load balancing device is avoided.
In an alternative embodiment, in order to avoid excessive occupation of resources of the load balancing apparatus, such as memory resources, the instance data may be filtered to determine which instance data needs to be cached. The step S15 includes:
step a1, obtaining an access index between the first service and the second service, where the access index includes: frequency of access and/or time of access.
Step A2, when the access index meets a first preset condition, caching the first service relationship data into a service relationship data set.
Specifically, the access frequency and the access time between services can be counted in real time by the load balancing device. For example, when an access request between services is received each time, relevant information of the access request, such as an access party service, an accessed service, access time and the like, is recorded, so that statistics on access indexes can be performed later. Wherein, the access frequency meeting the first preset condition comprises: the access time satisfying the first preset condition includes: the time interval between the access time and the current time is less than or equal to a preset time interval.
Optionally, the access index in step a1 may be counted by the service relationship storage state, and when the service relationship is fed back, the access index between services is fed back to the load balancing apparatus. The load balancing device does not need to store instance data which is accessed less frequently or has been accessed for a longer time last. Therefore, the data volume cached by the load balancing device can be reduced, the resource occupation of the load balancing device is reduced, and the stability of the performance of the load balancing device is ensured.
In another alternative embodiment, the load balancing apparatus may also determine whether to cache the instance data based on the number of pieces or amount of data it can cache. The step S15 includes: and when the number of the data in the service relation data set is less than the preset number and/or the data volume of the service relation data set is less than the preset capacity, caching the first service relation data into the service relation data set.
In order to ensure the normal operation of the load balancing device, the load balancing device can set the maximum number of the cached instance data and/or the maximum cache capacity, and the maximum number of the cached instance data and/or the maximum cache capacity cannot be exceeded when the instance data is cached, so that the data volume cached by the load balancing device can be controlled, the resources of the load balancing device are prevented from being excessively occupied, and the stability of the performance of the load balancing device is ensured.
The above-mentioned method of the present application is described in detail below by way of a specific example.
Fig. 5 is an interaction flowchart of an access request processing method according to another embodiment of the present application, and as shown in fig. 5, the method includes the following steps:
step S701, a load balancing device receives a first access request RequestA;
step S702, the load balancing device identifies the service A which the load balancing device needs to access through the attribute information of RequestA;
step S703, the load balancing apparatus sends a service query request Search1 to the service relationship storage apparatus to query the associated service of the service a;
step S704, the service relation storage device inquires an associated service list of the service A according to the service inquiry request, wherein the associated service list comprises the service B, C;
step S705, the service relation storage device feeds back the associated service list to the load balancing device;
step S706, the load balancing device sends an instance query request to the service center to query instance data corresponding to the service A, B, C;
step S707, the service center feeds back instance data instanceA, instanceB and instanceC corresponding to the inquired service A, B, C to the load balancing device;
step S708, the load balancing apparatus caches instance data InstanceA, InstanceB, InstanceC of the service A, B, C;
step S709, the load balancing apparatus sends the RequestA to the server RS corresponding to the InstanceAA
Step S710, server RSADetermining that a service B needs to be called in the process of providing the service A;
step S711, Server RSASending a second access request RequestB to the load balancing device;
step S712, the load balancing apparatus hits the cached instance data InstanceB of the service B;
step S713, the load balancing device sends the RequestB to the server RS corresponding to the InstanceBB
Step S714, server RSBDetermining that a service C needs to be called in the process of providing the service B;
step S715, server RSBSending a second access request RequestC to the load balancing device;
step S716, the load balancing apparatus hits the cached instance data InstanceC of the service C;
in step S717, the load balancing apparatus transmits the RequestC to the server RS corresponding to the InstanceCC
For example, service a in the above embodiments may be a goods listing service, service B an order service, and service C an inventory service. And displaying commodities to the user through the service A, placing orders through the service B, and inquiring whether the inventory can be placed through the service C before placing the orders.
In the above specific example, when an access request to a service in the load balancing cluster is received, the service and the instance data corresponding to the associated service thereof are cached locally in the load balancing device, so that when the associated service is called, the instance data of the associated service is queried from the cached service relationship data, and the access request is directly forwarded to the server corresponding to the instance data. Therefore, the service center does not need to be visited to obtain the instance data corresponding to the service every time, the cache hit rate of the load balancing device is improved, the communication times between the load balancing device and the service center are greatly reduced, the processing delay of the service calling request is reduced, and the timeliness of the service calling is improved. Meanwhile, the communication frequency between the load balancing device and the service center is reduced, and the cache pressure of the memory on the instance data is reduced, so that the problem of cache jitter is avoided, and the performance of the whole server cluster is improved.
The following are embodiments of the apparatus of the present application that may be used to perform embodiments of the method of the present application.
Fig. 6 is a block diagram of an access request processing apparatus provided in an embodiment of the present application, which may be implemented as part of or all of an electronic device through software, hardware, or a combination of the two. As shown in fig. 6, the access request processing apparatus applied to the load balancing apparatus includes:
an obtaining module 81, configured to determine a first service corresponding to the first access request, and obtain first instance data corresponding to the first service;
a transmission module 82, configured to send the first access request to a first server corresponding to the first instance data;
the query module 83 is configured to, when the transmission module receives a second access request for the second service from the first server, query the cached service relationship data set to obtain second instance data corresponding to the second service, where the service relationship data set includes the second service associated with the first service and the second instance data corresponding to the second service;
a determining module 84, configured to determine, according to the instance data, that the second access request corresponds to the second server;
a transmission module 82, configured to send the second access request to the second server.
Optionally, the obtaining module 81 is configured to extract the first attribute information from the first access request; determining a first service corresponding to the first access request according to the first attribute information; querying at least one second service associated with the first service according to the first attribute information; acquiring first service relation data of the first service and the second service, wherein the first service relation data comprises first instance data corresponding to the first service and second instance data corresponding to the second service; caching the first service relationship data into the service relationship data set.
Fig. 7 is a block diagram of an access request processing system according to an embodiment of the present application, and as shown in fig. 7, the system includes: a load balancing device 101, a service relation storage device 102 and a service center 103;
a service relation storage device 102, configured to store service relation data between associated services;
the service center 103 is used for storing instance data corresponding to the service;
a load balancing device 101, configured to receive a first access request for a first service; extracting first attribute information from the first access request; in the service relation storage device 102, at least one second service associated with the first service is queried according to the first attribute information; querying first service relation data of a first service and a second service from a service center 103, wherein the first service relation data comprises first instance data corresponding to the first service and second instance data corresponding to the second service; caching the first service relationship data into a service relationship data set;
the load balancing device 101 is further configured to determine a first service corresponding to the first access request, and query, from the service relationship data set, first instance data corresponding to the first service; sending the first access request to a first server 104a corresponding to the first instance data; when receiving a second access request for accessing a second service from the first server 104a, the access request queries from the service relationship data set to obtain second instance data corresponding to the second service; determining that the second access request corresponds to the second server 104b according to the second instance data; the second access request is sent to the second server 104 b.
Optionally, the load balancing apparatus 101 is configured to obtain an access index between the first service and the second service, where the access index includes: access frequency and/or access time; and caching the first service relation data into the service relation data set when the access index meets a first preset condition.
Optionally, the service relationship storage device 102 may be further configured to obtain an access index between the first service and the second service from the load balancing device 101, where the access index includes: access frequency and/or access time; when the access index meets the first preset condition, the first service relationship data is sent to the load balancing apparatus 101. In an optional embodiment, the load balancing apparatus 101 counts access indexes between the first service and the second service, and filters the instance data in the service relationship data based on the access indexes, without storing the instance data with a low access frequency or a long last access time. Alternatively, the service relationship storage apparatus 102 may filter the service list fed back to the load balancing apparatus 101 based on the access index directly, and delete the service with a low storage access frequency or a long last access time. Therefore, the data volume cached by the load balancing device can be reduced, the resource occupation of the load balancing device is reduced, and the stability of the performance of the load balancing device is ensured.
In this system, there may be a plurality of load balancing devices, each of which may implement the functions of the above-described embodiments.
An embodiment of the present application further provides an electronic device, as shown in fig. 8, the electronic device may include: the system comprises a processor 1501, a communication interface 1502, a memory 1503 and a communication bus 1504, wherein the processor 1501, the communication interface 1502 and the memory 1503 complete communication with each other through the communication bus 1504.
A memory 1503 for storing a computer program;
the processor 1501, when executing the computer program stored in the memory 1503, implements the steps of the method embodiments described below.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (pci) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
The present application also provides a computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present invention, which enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. An access request processing method, comprising:
determining a first service corresponding to a first access request, and acquiring first instance data corresponding to the first service;
sending the first access request to a first server corresponding to the first instance data;
when a second access request for accessing a second service from the first server is received, second instance data corresponding to the second service is obtained by inquiring from a cached service relation data set, wherein the service relation data set comprises the second service related to the first service and the second instance data corresponding to the second service;
determining that the second access request corresponds to a second server according to the second instance data;
sending the second access request to the second server.
2. The method of claim 1, wherein determining the first service corresponding to the first access request and obtaining the first instance data corresponding to the first service comprises:
extracting first attribute information from the first access request;
determining a first service corresponding to the first access request according to the first attribute information;
querying at least one second service associated with the first service according to the first attribute information;
acquiring first service relation data of the first service and the second service, wherein the first service relation data comprises first instance data corresponding to the first service and second instance data corresponding to the second service;
caching the first service relationship data into the service relationship data set.
3. The method according to claim 1, wherein the querying the cached service relationship data for the instance data corresponding to the second service includes:
obtaining a cache validity period corresponding to the service relation data containing the second service;
and when the current time is determined to be within the caching validity period, extracting the instance data corresponding to the second service from the service relation data containing the second service.
4. The method of claim 2, wherein caching the first service relationship data into the service relationship data set comprises:
obtaining an access index between the first service and the second service, the access index including: access frequency and/or access time;
caching the first service relationship data into the service relationship data set when the access index meets a first preset condition;
wherein, the access frequency meeting a first preset condition comprises: the access frequency is greater than or equal to a first value; the access time meeting a first preset condition comprises the following steps: the time interval between the access time and the current time is less than or equal to a preset time interval.
5. The method of claim 2, wherein caching the first service relationship data into the service relationship data set comprises:
and when the number of the data in the service relationship data set is smaller than a preset number and/or the data volume of the service relationship data set is smaller than a preset capacity, caching the first service relationship data into the service relationship data set.
6. An access request processing apparatus, comprising:
the acquisition module is used for determining a first service corresponding to a first access request and acquiring first instance data corresponding to the first service;
the transmission module is used for sending the first access request to a first server corresponding to the first instance data;
the query module is configured to, when the transmission module receives a second access request for accessing a second service from the first server, query from a cached service relationship data set to obtain second instance data corresponding to the second service, where the service relationship data set includes the second service associated with the first service and the second instance data corresponding to the second service;
the determining module is used for determining that the second access request corresponds to a second server according to the example data;
the transmission module is configured to send the second access request to the second server.
7. The apparatus according to claim 6, wherein the obtaining module is configured to extract first attribute information from the first access request; determining a first service corresponding to the first access request according to the first attribute information; querying at least one second service associated with the first service according to the first attribute information; acquiring first service relation data of the first service and the second service, wherein the first service relation data comprises first instance data corresponding to the first service and second instance data corresponding to the second service; caching the first service relationship data into the service relationship data set.
8. An access request processing system, comprising: the system comprises a load balancing device, a service relation storage device and a service center;
the service relation storage device is used for storing service relation data among the associated services;
the service center is used for storing instance data corresponding to the service;
the load balancing device is used for receiving a first access request of a first service; extracting first attribute information from the first access request; in the service relation storage device, inquiring a second service associated with the first service according to the first attribute information; inquiring first service relation data of the first service and a second service from the service center, wherein the first service relation data comprises first instance data corresponding to the first service and second instance data corresponding to the second service; caching the first service relationship data into the service relationship data set;
the load balancing device is further configured to determine a first service corresponding to a first access request, and query, from the service relationship data set, first instance data corresponding to the first service; sending the first access request to a first server corresponding to the first instance data; when receiving a second access request for accessing a second service from the first server, the access request queries from the service relationship data set to obtain second instance data corresponding to the second service; determining that the second access request corresponds to a second server according to the second instance data; sending the second access request to the second server.
9. An electronic device, comprising: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
the memory is used for storing a computer program;
the processor, when executing the computer program, implementing the method steps of any of claims 1-5.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method steps of any one of claims 1 to 5.
CN202011551989.7A 2020-12-24 2020-12-24 Access request processing method, device and system Active CN112667396B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011551989.7A CN112667396B (en) 2020-12-24 2020-12-24 Access request processing method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011551989.7A CN112667396B (en) 2020-12-24 2020-12-24 Access request processing method, device and system

Publications (2)

Publication Number Publication Date
CN112667396A true CN112667396A (en) 2021-04-16
CN112667396B CN112667396B (en) 2023-09-01

Family

ID=75409971

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011551989.7A Active CN112667396B (en) 2020-12-24 2020-12-24 Access request processing method, device and system

Country Status (1)

Country Link
CN (1) CN112667396B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114338769A (en) * 2021-12-22 2022-04-12 浙江中控技术股份有限公司 Access request processing method and device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7616640B1 (en) * 1998-12-02 2009-11-10 Cisco Technology, Inc. Load balancing between service component instances
JP2011118587A (en) * 2009-12-02 2011-06-16 Hitachi Ltd System for executing cooperative service by plurality of servers
CN106998370A (en) * 2017-06-15 2017-08-01 北京微影时代科技有限公司 Access control method, device and system
CN110297862A (en) * 2019-07-04 2019-10-01 中国联合网络通信集团有限公司 Data bank access method and Database-access Middleware Based
WO2020056550A1 (en) * 2018-09-17 2020-03-26 上海诺基亚贝尔股份有限公司 Service distribution device and method in software defined network, and storage medium
CN111212099A (en) * 2018-11-22 2020-05-29 青岛海信智能商用系统股份有限公司 Micro-service management method and device
CN111651488A (en) * 2020-05-29 2020-09-11 泰康保险集团股份有限公司 Database service processing method, device, medium and electronic equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7616640B1 (en) * 1998-12-02 2009-11-10 Cisco Technology, Inc. Load balancing between service component instances
JP2011118587A (en) * 2009-12-02 2011-06-16 Hitachi Ltd System for executing cooperative service by plurality of servers
CN106998370A (en) * 2017-06-15 2017-08-01 北京微影时代科技有限公司 Access control method, device and system
WO2020056550A1 (en) * 2018-09-17 2020-03-26 上海诺基亚贝尔股份有限公司 Service distribution device and method in software defined network, and storage medium
CN111212099A (en) * 2018-11-22 2020-05-29 青岛海信智能商用系统股份有限公司 Micro-service management method and device
CN110297862A (en) * 2019-07-04 2019-10-01 中国联合网络通信集团有限公司 Data bank access method and Database-access Middleware Based
CN111651488A (en) * 2020-05-29 2020-09-11 泰康保险集团股份有限公司 Database service processing method, device, medium and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114338769A (en) * 2021-12-22 2022-04-12 浙江中控技术股份有限公司 Access request processing method and device
CN114338769B (en) * 2021-12-22 2024-04-12 浙江中控技术股份有限公司 Access request processing method and device

Also Published As

Publication number Publication date
CN112667396B (en) 2023-09-01

Similar Documents

Publication Publication Date Title
CN105337786B (en) A kind of server performance detection method, device and equipment
CN111262795B (en) Service interface-based current limiting method and device, electronic equipment and storage medium
CN110830565B (en) Resource downloading method, device, system, electronic equipment and storage medium
CN108647240B (en) Method and device for counting access amount, electronic equipment and storage medium
CN110932988A (en) Flow control method and device, electronic equipment and readable storage medium
CN109167840B (en) Task pushing method, node autonomous server and edge cache server
US11734367B2 (en) Direct data center request for proxy web scraping
CN111416883B (en) Address query method, device, terminal and computer readable storage medium
CN111611283A (en) Data caching method and device, computer readable storage medium and electronic equipment
CN112667396B (en) Access request processing method, device and system
CN107332703B (en) Method and device for checking multi-application logs
CN114528231A (en) Data dynamic storage method and device, electronic equipment and storage medium
CN110233843B (en) User request processing method and device
CN115277588B (en) Fusing current limiting system based on middle platform system
CN108737493B (en) Address allocation method and device and electronic equipment
CN114676074A (en) Access request processing method and device, electronic equipment and storage medium
CN115271861A (en) Request filtering method, device, equipment and storage medium
US20230018983A1 (en) Traffic counting for proxy web scraping
CN114157482A (en) Service access control method, device, control equipment and storage medium
WO2020199029A1 (en) Data processing method and apparatus therefor
JP2021527276A5 (en)
CN112861031A (en) URL (Uniform resource locator) refreshing method, device and equipment in CDN (content delivery network) and CDN node
CN117743206B (en) Data storage method and device
CN104509071A (en) Processing requests
CN117235161A (en) Interface concurrency control method, device, equipment and storage medium

Legal Events

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