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

Access request processing method, device and system Download PDF

Info

Publication number
CN112667396B
CN112667396B CN202011551989.7A CN202011551989A CN112667396B CN 112667396 B CN112667396 B CN 112667396B CN 202011551989 A CN202011551989 A CN 202011551989A CN 112667396 B CN112667396 B CN 112667396B
Authority
CN
China
Prior art keywords
service
access
access request
data
instance data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011551989.7A
Other languages
Chinese (zh)
Other versions
CN112667396A (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

Abstract

The application relates to a method, a device and a system for processing an access request. Therefore, the service center is not required to acquire the instance data corresponding to the service when each access request is made, the communication times between the load balancing device and the service center can be greatly reduced, the processing time delay of the service call request is reduced, and the timeliness of the service call 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, service distribution is in clustered and centralized development, i.e. multiple services are simultaneously provided by 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 business complexities or traffic volumes. In the service calling process, the load balancing device requests the instance data of the called service from the service center according to the service calling request sent from the outside, and routes the service calling request to the instance of the called service according to a certain strategy.
When a large number of services are provided in the service cluster and frequent inter-modulation is used among the services, the load balancing device needs to frequently request instance data of the services to the service center, so that the communication pressure between the load balancing device and the middle of the services is increased, the processing time delay of service call requests is also increased, and the timeliness of service call is affected.
Disclosure of Invention
In order to solve the above technical problems or at least partially solve the above technical problems, the present application provides a method, an apparatus, and a system for processing an access request.
In one aspect, the present application provides a method for processing an access request, 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 is received from the first server, obtaining second instance data corresponding to the second service from a cached service relation data set, wherein the service relation data set comprises the second service associated with 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;
and sending the second access request to the second server.
Optionally, the determining the first service corresponding to the first access request, and obtaining the 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;
and caching the first service relation data into the service relation data set.
Optionally, the querying the instance data corresponding to the second service from the cached service relationship data includes:
acquiring a cache validity period corresponding to service relation data comprising the second service;
and when the current time is determined to be within the cache effective period, extracting instance data corresponding to the second service from 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, wherein the access index comprises: access frequency and/or access time;
when the access index meets a first preset condition, caching the first service relation data into the service relation data set;
wherein the access frequency meeting the first preset condition includes: the access frequency is greater than or equal to a first value; the access time meeting the first preset condition comprises the following steps: the time interval between the access time and the current time is smaller 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 data in the service relation data set is smaller than a preset number and/or the data volume of the service relation data set is smaller than a preset capacity, caching the first service relation data into the service relation 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 used for querying and obtaining second instance data corresponding to a second service from a cached service relation data set when the transmission module receives a second access request for accessing the second service from the first server, 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;
the determining module is used for determining that the second access request corresponds to a second server according to the instance data;
the transmission module is configured to send the second access request to the second server.
Optionally, the acquiring 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; and caching the first service relation data into the service relation data set.
In another aspect, the present application provides an access request processing system, including: load balancing device, service relation storage device and service center;
the service relation storage device is used for storing service relation data between 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 for a first service; extracting first attribute information from the first access request; querying, in the service relationship storage device, at least one second service associated with the first service according to the first attribute information; querying first service relation data of the first service and the 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 first instance data corresponding to the first service from the service relationship data set; sending the first access request to a first server corresponding to the first instance data; when receiving a second access request from the first server for accessing a second service, the access request queries from the service relation 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; and 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 apparatus including: the device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the above-mentioned method steps when executing the computer program.
According to another aspect of an embodiment of the present application, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the above-mentioned method steps.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages:
according to the embodiment, the service relation data are cached in advance, when the associated service is called, the instance data of the associated service are queried from the cached service relation data, and the access request is directly forwarded to the server corresponding to the instance data. Therefore, the service center is not required to acquire the instance data corresponding to the service when each access request is made, the communication times between the load balancing device and the service center can be greatly reduced, the processing time delay of the service call request is reduced, and the timeliness of the service call is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the application or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, and it will be obvious to a person skilled in the art that other drawings can be obtained from these drawings without inventive effort.
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 a method for processing an access request according to another embodiment of the present application;
FIG. 3 is a flowchart of a method for processing an access request according to another embodiment of the present application;
FIG. 4 is a flowchart of a method for processing an access request according to another embodiment of the present application;
FIG. 5 is an interactive flowchart of an access request processing method 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
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
For a cluster of servers providing multiple services, there is a dependency call relationship between the services, e.g., a commodity purchase service of a shopping application may call a transaction payment service, etc. In the following embodiments of the present application, a service having a dependency call relationship is referred to as an associated service.
In this embodiment, the instance data of other services associated with the service requested by the user is loaded into the cache, so when other services need to be accessed, the instance data of the service can be directly searched from the cache, and then the corresponding server is accessed, so that 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 time delay of the service call request is reduced, and the timeliness of service call is improved.
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 a cache transaction for service instance data, other caches which need to communicate can communicate after waiting for service instance data cache communication (update access), and then cache jitter can be generated, so that the performance of the whole server cluster is reduced. According to the scheme provided by 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 to the instance data is reduced, so that the problem of cache jitter is avoided, and the performance of the whole server cluster is improved.
Among them, example data (Instance) include: the Server addresses of the servers (RS) that actually provide the external service may be plural in the Server cluster, and thus, the instance data corresponding to the service may include plural Server addresses.
The following first describes the access request processing method according to the embodiment of the present application 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 comprises 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 domain name, path, and the like, and based on these information, the load balancing device may identify the service a.
After identifying service a, optionally, if the load balancing device itself has cached instance data of service a (InstanceA), then InstanceA of service a may be obtained directly from the local cache. If the access request to the service a is received for the first time, the load balancing device does not cache the InstanceA, the load balancing device can request the InstanceA from the service center, or query the service relationship storage device for the associated service of the service a, and then acquire the instance data of the service a and the associated service thereof from the service center. Wherein the InstanceA contains the address of the server that actually provides service A.
Step S12, a first access request is sent to a first server corresponding to the first instance data.
In this step, the first server (RS) corresponding to service A can be determined from InstanceA A ) Address, thereby transmitting RequestA to RS A
Step S13, when a second access request for accessing a second service is received from the first server, second instance data corresponding to the second service is obtained by inquiring from a cached service relation data set, and the service relation data set comprises the second service associated with the first service and the second instance data corresponding to the second service.
Because there is a dependency call relationship between services, when the service a is used and the second service (service B) needs to be called, if the RS1 sends a second access Request (Request 2) to the service B to the load balancing device, the load balancing device queries the locally cached service relationship data set, and because the service relationship data set stores the Instance data of other services associated with the first service in advance, the second Instance data (Instance 2) corresponding to the service B can be queried 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 Instance2 contains the server address that actually provides service B, so that the RSB corresponding to Request2 can be determined based on Instance 2.
Step S15, a second access request is sent to a second server.
Step S11 to step S15 are implemented by caching service relation data in advance, and when the associated service is called, inquiring the instance data of the associated service from the cached service relation data, and directly forwarding the access request to a server corresponding to the instance data. Therefore, the service center is not required to acquire the instance data corresponding to the service every time the service is accessed, 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 time delay of the service call request is reduced, and the timeliness of the service call is improved. Meanwhile, the communication times between the load balancing device and the service center are reduced, the cache pressure of the memory to the instance data is reduced, 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 device does not cache the instance data of the first service, step S11 includes the following steps:
step S21, extracting the first attribute information from the first access request.
Wherein the first attribute information includes at least one of: domain name, path, request header, and query parameters. The Path refers to the relative Path of the resource.
In step S21, the req object may be used to process the first access request, e.g. by req.host, where the domain name (Host) in the first access request may be obtained; a path, such as a URI, in the first access request can be obtained through the req.path; the request header in the first access request can be obtained through the req.header; the query parameters in the first access request may be obtained by the request.
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.
And step S23, at least one second service associated with the first service is queried according to the first attribute information.
Step S24, first service relation data of the first service and the second service are obtained, wherein the first service relation data comprises first instance data corresponding to the first service and second instance data corresponding to the second service.
Step S25, the first service relation data is cached in the service relation 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 including the association relationship between the services A, B, C and the instance data thereof in the service relationship data set local to the load balancing server. In this way, the load balancing device obtains the instance data of the service a and the instance data of the service B, C associated with the service a, and invokes the service B, C in the process that the service a is used, so that the load balancing device can directly query the cached service relationship data set to obtain the instance data of the service B, C, and then can access the server corresponding to the service B, C.
In an alternative embodiment, when the second service is invoked, 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 includes:
step S41, obtaining second attribute information of a second service;
step S42, inquiring 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 queried from the service relation data set, acquiring second service relation data of the second service and the third service;
step S44, the second service relation data is cached in the service relation data set.
For example, the load balancing device queries the service C, D, E associated with service B from the service relationship storage device, wherein the instance data for service C is already stored in the service relationship data set and the instance data for service D, E is not in the service relationship data set. Therefore, the load balancing apparatus may acquire the instance data of the service D, E only from the service center without acquiring the instance data of the service C again from the service center.
Through the steps S41 to S44, the load balancing device can cache the instance data of other services associated with the current request service each time an access request is received, 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, so that 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 time delay of the service call request is reduced, and the timeliness of service call is improved; and the cache pressure of the memory to 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 service instance data is acquired, the cached service instance data is not acquired any more, so that the load balancing device is prevented from acquiring and storing repeated data, and the occupation of the resource 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 device may randomly select one server address from the plurality of server addresses to access the server corresponding to the server address. However, there are differences in the performance of the servers providing the service, and the number of receivable service requests is also different, and in order to achieve load balancing based on the performance of the servers, the 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, as shown in fig. 4, the step S14 includes the following steps:
step S51, at least two server addresses and weights corresponding to the server addresses in the second instance data are obtained;
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 instance data corresponding to the service B includes two server addresses IP: PORT and WEIGHT of 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 has a weight of 100 and the second server address 10.10.1.2:80 has a weight of 200. Based on the weights, the number of requests received by each server address for servers RSB1 and RSB2 can be limited, if there are 90 access requests, 30 access requests are forwarded to RSB1 and 60 access requests are forwarded to RSB2.
Specifically, the access requests corresponding to the second service may be ordered according to the access time, for example, the 1 st access request is forwarded to RSB1, and the 2 nd and 3 rd access requests are forwarded to RSB2; or the 1 st to 10 th access requests are forwarded to RSB1 and the 11 th to 30 th access requests are forwarded to RSB2; etc. The manner of determining the server corresponding to the access request based on the weight is not limited thereto, and there may be many other methods, which will not be described herein.
The steps S51 to S53 determine the servers corresponding to the access requests based on the weights corresponding to the service addresses in the instance data, and the number of requests received by each server can be limited by the weights, so that the stability of the performance of the server is ensured, and the stability and reliability of the service provided by the server are also improved.
In an alternative embodiment, the step S15 includes: acquiring a cache validity period corresponding to service relation data comprising the second service; and when the current time is determined to be within the cache effective period, extracting instance data corresponding to the second service from service relation data containing the second service. And setting a cache validity period for the service relation data, for example, 1 minute, if the service relation data is within 1 minute, the load balancing device can hit the instance data of the second service, and if the service relation data exceeds 1 minute, the load balancing device needs to acquire the instance data corresponding to the second service again. In this way, firstly, the service relationship 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 instance data in the service relationship data within the period of time, the processing time delay of the service request is reduced, and the cache hit rate is improved; and secondly, the excessive occupation of resources caused by the long-time storage of service relation data by the load balancing device is avoided.
In an alternative embodiment, to avoid excessive occupation of resources of the load balancing device, 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, access indexes between a first service and a second service are obtained, wherein the access indexes comprise: access frequency and/or access time.
And step A2, when the access index meets a first preset condition, caching the first service relation data into a service relation data set.
Specifically, the load balancing device can count the access frequency and access time among the services in real time. For example, each time an access request is received between services, relevant information of the access request, such as the service of the accessing party, the accessed service, the access time and the like, is recorded, so that statistics of access indexes can be performed subsequently. The access frequency meeting the first preset condition comprises the following steps: the access time meeting the first preset condition comprises: the time interval between the access time and the current time is less than or equal to a preset time interval.
Optionally, the access indexes in the step A1 may be counted by the service relationship storage state, and when the service relationship is fed back, the access indexes between the services are fed back to the load balancing device. The load balancing device does not need to store instance data with lower access frequency or longer last access time. Therefore, the data volume cached by the load balancing device can be reduced, the resource occupation is reduced, and the stability of the performance of the load balancing device is ensured.
In another alternative embodiment, the load balancing device may also determine whether to cache instance data based on the number of data stripes or the amount of data that it is able to cache. The step S15 includes: and when the number of data in the service relation data set is smaller than the preset number and/or the data volume of the service relation data set is smaller than the preset capacity, caching the first service relation data in 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 and/or the maximum cache capacity of the cache instance data, and the maximum number and/or the maximum cache capacity cannot be exceeded when the instance data is cached, so that the data quantity 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-described method of the present application will be described in detail with reference to a specific example.
Fig. 5 is an interactive flowchart of an access request processing method according to another embodiment of the present application, as shown in fig. 5, the method includes the following steps:
step S701, the 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 the RequestA;
step S703, the load balancing device sends a service query request Search1 to the service relationship storage device to query the associated service of the service a;
step S704, the service relation storage device queries an associated service list of the service a according to the service query request, where the associated service list includes 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 the instance data InstanceA, instanceB, instanceC corresponding to the queried service A, B, C to the load balancing device;
step S708, the load balancing device caches the instance data InstanceA, instanceB, instanceC of the service A, B, C;
step S709, the load balancing device sends the RequestA to the server RS corresponding to the InstanceA A
Step S710, server RS A Determining that the service B needs to be called in the process of providing the service A;
step S711, server RS A Sending a second access request RequestB to the load balancing device;
step S712, the load balancing device hits the cached instance data InstanceB of service B;
in step S713, the load balancing device sends the RequestB to the server RS corresponding to InstanceB B
Step S714, server RS B Determining that the service C needs to be called in the process of providing the service B;
step S715, server RS B Sending a second access request RequestC to the load balancing device;
step S716, the load balancing device hits the cached instance data InstanceC of service C;
step S717, the load balancing device sends the RequestC to the server RS corresponding to the InstanceC C
For example, service a in the above embodiment may be a commodity list service, service B is an order service, and service C is an inventory service. And displaying commodities to a user through the service A, ordering through the service B, and inquiring whether inventory can be ordered through the service C before ordering.
In the specific example, when an access request to a service in the load balancing cluster is received, the service and the example data corresponding to the associated service are cached to the local of the load balancing device, so that when the associated service is called, the example 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 example data. Therefore, the service center is not required to acquire the instance data corresponding to the service every time of access request, 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 time delay of the service call request is reduced, and the timeliness of the service call is improved. Meanwhile, the communication times between the load balancing device and the service center are reduced, the cache pressure of the memory to the instance data is reduced, the problem of cache jitter is avoided, and the performance of the whole server cluster is improved.
The following are examples of the apparatus of the present application that may be used to perform the method embodiments of the present application.
Fig. 6 is a block diagram of an access request processing apparatus according to an embodiment of the present application, where the apparatus may be implemented as part or all of an electronic device by software, hardware, or a combination of both. As shown in fig. 6, the access request processing apparatus is applied to a load balancing apparatus, and 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 a first access request to a first server corresponding to the first instance data;
a query module 83, configured to query from a cached service relationship data set to obtain second instance data corresponding to a second service when the transmission module receives a second access request for the second service from the first server, 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;
and a transmission module 82, configured to send the second access request to the second server.
Optionally, an 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; and caching the first service relation data into the service relation data set.
Fig. 7 is a block diagram of an access request processing system according to an embodiment of the present application, as shown in fig. 7, where the system includes: load balancing means 101, service relationship storage means 102, and service center 103;
service relation storage means 102 for storing service relation data between associated services;
a service center 103 for storing instance data corresponding to a service;
load balancing means 101 for receiving a first access request to a first service; extracting first attribute information from the first access request; querying, in the service relationship storage 102, at least one second service associated with the first service 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 first instance data corresponding to the first service from the service relationship data set; transmitting a first access request to a first server 104a corresponding to the first instance data; when receiving a second access request from the first server 104a for accessing a second service, 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 based on the second instance data; the second access request is sent to the second server 104b.
Optionally, the load balancing device 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 when the access index meets a first preset condition, caching the first service relation data into the service relation data set.
Optionally, the service relation storage device 102 may be further configured to obtain, from the load balancing device 101, an access index between the first service and the second service, where the access index includes: access frequency and/or access time; when the access index satisfies the first preset condition, the first service relationship data is sent to the load balancing device 101. In an alternative embodiment, the load balancing device 101 counts the access index between the first service and the second service, and filters the instance data in the service relationship data based on the access index, without storing the instance data with a lower access frequency or a longer last access time. Alternatively, the service relationship storage 102 may directly filter the service list fed back to the load balancing device 101 based on the access index, and delete the service having a low frequency of memory access or a longer last access time. Therefore, the data volume cached by the load balancing device can be reduced, the resource occupation 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 apparatuses, each of which can realize the functions of the above-described embodiments.
The embodiment of the application also provides an electronic device, as shown in fig. 8, the electronic device may include: the device 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 are in 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 above for the electronic devices may be a peripheral component interconnect standard (Peripheral Component Interconnect, pi) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include 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 aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processing, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
The application also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the above-described method embodiments.
It should be noted that in this document, relational terms such as "first" and "second" and the like are 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. Moreover, 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing is only a specific embodiment of the application to enable those skilled in the art to understand or practice the application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (7)

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 is received from the first server, obtaining second instance data corresponding to the second service from a cached service relation data set, wherein the service relation data set comprises the second service associated with 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;
the determining the first service corresponding to the first access request, and obtaining the 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;
the caching the first service relationship data in the service relationship data set includes:
obtaining an access index between the first service and the second service, wherein the access index comprises: access frequency and/or access time;
when the access index meets a first preset condition, caching the first service relation data into the service relation data set;
wherein the access frequency meeting the first preset condition includes: the access frequency is greater than or equal to a first value; the access time meeting the first preset condition comprises the following steps: the time interval between the access time and the current time is smaller than or equal to a preset time interval.
2. The method of claim 1, wherein querying the cached service relationship data for instance data corresponding to the second service comprises:
acquiring a cache validity period corresponding to service relation data comprising the second service;
and when the current time is determined to be within the cache effective period, extracting instance data corresponding to the second service from service relation data containing the second service.
3. The method of claim 1, wherein said caching said first service relationship data into said service relationship data set comprises:
and when the number of data in the service relation data set is smaller than a preset number and/or the data volume of the service relation data set is smaller than a preset capacity, caching the first service relation data into the service relation data set.
4. 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 used for querying and obtaining second instance data corresponding to a second service from a cached service relation data set when the transmission module receives a second access request for accessing the second service from the first server, 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;
the determining module is used for determining that the second access request corresponds to a second server according to the instance data;
the transmission module is used for sending the second access request to the second server;
the acquisition module is used for 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;
the obtaining module is further 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; when the access index meets a first preset condition, caching the first service relation data into the service relation data set; wherein the access frequency meeting the first preset condition includes: the access frequency is greater than or equal to a first value; the access time meeting the first preset condition comprises the following steps: the time interval between the access time and the current time is smaller than or equal to a preset time interval.
5. An access request processing system, comprising: load balancing device, service relation storage device and service center;
the service relation storage device is used for storing service relation data between 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 for a first service; extracting first attribute information from the first access request; querying a second service associated with the first service according to the first attribute information in the service relation storage device; querying first service relation data of the first service and the 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 a service relationship data set;
the load balancing device is further configured to determine a first service corresponding to a first access request, and query first instance data corresponding to the first service from the service relationship data set; sending the first access request to a first server corresponding to the first instance data; when receiving a second access request from the first server for accessing a second service, the access request queries from the service relation 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;
the load balancing device is further 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; when the access index meets a first preset condition, caching the first service relation data into the service relation data set; wherein the access frequency meeting the first preset condition includes: the access frequency is greater than or equal to a first value; the access time meeting the first preset condition comprises the following steps: the time interval between the access time and the current time is smaller than or equal to a preset time interval.
6. An electronic device, comprising: the device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
the memory is used for storing a computer program;
the processor being adapted to carry out the method steps of any of claims 1-3 when the computer program is executed.
7. A computer-readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, carries out the method steps of any of claims 1-3.
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 CN112667396A (en) 2021-04-16
CN112667396B true 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)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114338769B (en) * 2021-12-22 2024-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

Also Published As

Publication number Publication date
CN112667396A (en) 2021-04-16

Similar Documents

Publication Publication Date Title
CN105337786B (en) A kind of server performance detection method, device and equipment
US20130332569A1 (en) Service provider registration by a content broker
CN110830565B (en) Resource downloading method, device, system, electronic equipment and storage medium
CN111262795B (en) Service interface-based current limiting method and device, electronic equipment and storage medium
JP2008537816A (en) Method, system, and program for selecting a resource manager to satisfy a service request (selection of a resource manager to satisfy a service request)
CN103607424B (en) Server connection method and server system
CN108647240B (en) Method and device for counting access amount, electronic equipment and storage medium
CN113343088A (en) Data processing method, system, device, equipment and storage medium
CN111159219B (en) Data management method, device, server and storage medium
CN110677684B (en) Video processing method, video access method, distributed storage method and distributed video access system
CN107819632A (en) A kind of dynamic load leveling group system based on performance monitoring system and Docker Swarm
CN112667396B (en) Access request processing method, device and system
CN109873855A (en) A kind of resource acquiring method and system based on block chain network
CN115080272A (en) Business data processing method, electronic device and storage medium
CN114090623A (en) Method and device for creating cache resources, electronic equipment and storage medium
CN116662022B (en) Distributed message processing method, system, device, communication equipment and storage medium
CN114528231A (en) Data dynamic storage method and device, electronic equipment and storage medium
CN108737493B (en) Address allocation method and device and electronic equipment
CN115277588B (en) Fusing current limiting system based on middle platform system
CN110535853B (en) Video request scheduling method, device, server and storage medium
CN114676074A (en) Access request processing method and device, electronic equipment and storage medium
CN114185681A (en) Automatic current-limiting processing method and device
CN110598085B (en) Information query method for terminal and terminal
CN112132583A (en) Transaction processing method and device of block chain, electronic equipment and readable storage medium
US20060282434A1 (en) Access to fragmented database system

Legal Events

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