Disclosure of Invention
In view of the above, the present application provides a flow restriction processing method, apparatus, device and storage medium, which can realize a more stable flow restriction with lower delay in a larger flow scenario.
Based on the above, the technical scheme provided by the application is as follows:
In a first aspect, the present application provides a current limiting processing method, where the method is applied to a server included in a flow control cluster, where the flow control cluster is connected to one database cluster and at least one service cluster, and the method includes:
The method comprises the steps of obtaining a resource calling request sent by a database cluster, modifying a resource request count of a local tree of a server, determining a current limiting result by utilizing the resource request count of the local tree and a resource use count of a remote tree of the server, wherein the resource use count of the remote tree is determined based on the resource use count of the database tree of the database cluster, the resource use count is the sum of the resource request counts of the local tree of each server included in the flow control cluster obtained by the database cluster, and feeding back the current limiting result to the service cluster sending the resource calling request.
In one possible implementation, the local tree and the remote tree each include only one node, and the determining the current limit result using the resource request count of the local tree and the resource usage count of the remote tree of the server includes:
Calculating the sum of the resource request count of the local tree and the resource use count of the remote tree to obtain a first count, if the first count is smaller than a resource limit, the current limiting result is not current limiting, and if the first count is larger than or equal to the resource limit, the current limiting result is current limiting.
In one possible implementation, the local tree includes a root node and a plurality of leaf nodes, the root node corresponds to an available resource, the leaf nodes correspond to a service requesting to invoke the available resource, the resource request count includes a request count of the root node of the local tree and a request count of each of the leaf nodes of the local tree, the request count of the root node is a sum of the request counts of each of the leaf nodes, the remote tree includes a root node and a plurality of leaf nodes, each of the nodes of the local tree corresponds one-to-one with each of the nodes of the remote tree, the resource usage count of the remote tree includes a usage count of the root node of the remote tree and a usage count of each of the leaf nodes of the remote tree, and the usage count of the root node of the remote tree is a sum of the usage counts of the leaf nodes of each of the remote tree.
In one possible implementation manner, the number of times of the resource call request is 1, the resource call request includes information of a target available resource and information of a target service, and the modifying the resource request count of the local tree of the server includes:
And adding 1 to the request count of the root node corresponding to the target available resources included in the local tree, and adding 1 to the request count of the leaf node corresponding to the target business included in the root node corresponding to the target available resources.
In one possible implementation manner, the determining the current limit result by using the resource request count of the local tree and the resource usage count of the remote tree of the server includes:
And calculating the sum of the request count of the root node corresponding to the target available resource of the local tree and the request count of the root node corresponding to the target available resource of the remote tree to obtain a second count, wherein if the second count is smaller than the root limit of the root node corresponding to the target available resource, the current limiting result is not current limiting, and if the second count is larger than or equal to the root limit of the root node corresponding to the target available resource, the current limiting result is current limiting.
In one possible implementation manner, the determining the current limit result by using the resource request count of the local tree and the resource usage count of the remote tree of the server includes:
The method comprises the steps of obtaining a request count of a root node corresponding to a target available resource of a local tree, obtaining a sum of the request counts of the root node corresponding to the target available resource of a remote tree, obtaining a second count, obtaining a third count of a leaf node corresponding to the target service by calculating the request count of a leaf node corresponding to the target service of the local tree, obtaining the sum of the leaf nodes corresponding to the target service of the remote tree, obtaining a current limiting result as a current limiting result if the second count is smaller than the root limit of the root node corresponding to the target available resource and the third count is smaller than She Xiane of the leaf node corresponding to the target service, and obtaining the current limiting result as the current limiting result if the second count is larger than or equal to the root limit of the root node corresponding to the target available resource or the third count is larger than or equal to She Xiane of the leaf node corresponding to the target service.
In one possible implementation, the existence time of the local tree and the remote tree is a current limiting unit time, and the root quota and the leaf quota of each leaf node are determined based on the resource request count of the local tree and the resource usage count of the remote tree in the historical current limiting unit time, wherein the root quota is the sum of the leaf quota of each leaf node.
In one possible implementation, each leaf node included in the local tree has a priority, and the leaf quota of each leaf node is determined based on the root quota and the priority of each leaf node, where the leaf quota of the leaf node is positively correlated with the priority of the leaf node.
In one possible implementation, the method further includes:
and sending the local tree of the server to the database cluster according to the first frequency, wherein the local tree of the server is used for updating the resource use count of the database tree of the database cluster.
In one possible implementation, the method further includes:
And acquiring the database tree according to the second frequency, and updating the remote tree of the server by using the database tree.
In a second aspect, the present application provides a current limiting processing method, where the method is applied to a database cluster, and the database cluster is connected to a flow control cluster, and the method includes:
The method comprises the steps of obtaining a local tree sent by a server included in the flow control cluster, updating a database tree by utilizing the local tree, wherein the resource use count of the database tree is the sum of resource request counts of the local trees of all servers, and sending the database tree to the server included in the flow control cluster.
In one possible implementation, the local tree and the database tree include only one node, and the updating the database tree with the local tree includes:
and adding the resource request counts of the local trees to obtain the resource use count of the database tree.
In one possible implementation, the local tree includes a root node and a plurality of leaf nodes, the resource request count includes a request count of the root node of the local tree and a request count of each of the leaf nodes of the local tree, the request count of the root node is a sum of the request counts of each of the leaf nodes, the database tree includes a root node and a plurality of leaf nodes, each node of the database tree corresponds to each node of the local tree one-to-one, and the resource usage count of the database tree includes a usage count of the root node of the database tree and a usage count of each of the leaf nodes of the database tree, and the usage count of the root node of the database tree is a sum of the usage counts of the leaf nodes of each of the database tree.
In one possible implementation, the updating the database tree with the local tree includes:
The method comprises the steps of obtaining a request count of a root node of a local tree, calculating a sum of request counts of the root node of each local tree and historical use counts of the root node of a database tree to obtain an updated use count of the root node of the database tree, calculating a historical use count of a target leaf node of the database tree, and a sum of request counts of leaf nodes of each local tree corresponding to the target leaf node of the database tree to obtain an updated use count of the target leaf node of the database tree, wherein the target leaf node of the database tree is one of the leaf nodes included in the database tree.
In a third aspect, the present application provides a current limiting processing apparatus, where the apparatus is applied to a server included in a flow control cluster, where the flow control cluster is connected to one database cluster and at least one service cluster, and the apparatus includes:
an obtaining unit, configured to obtain a resource call request sent by the service cluster, and modify a resource request count of a local tree of the server;
A determining unit, configured to determine a current limiting result by using a resource request count of the local tree and a resource usage count of a remote tree of the server, where the resource usage count of the remote tree is determined based on a resource usage count of a database tree of the database cluster, and the resource usage count is a sum of resource request counts of local trees of respective servers included in the flow control cluster acquired by the database cluster;
and the feedback unit is used for feeding back the current limiting result to the service cluster which sends the resource calling request.
In one possible implementation manner, the local tree and the remote tree each include only one node, and the determining unit is specifically configured to calculate a sum of a resource request count of the local tree and a resource usage count of the remote tree to obtain a first count, if the first count is smaller than a resource allowance, the current limiting result is not current limiting, and if the first count is greater than or equal to the resource allowance, the current limiting result is current limiting.
In one possible implementation, the local tree includes a root node and a plurality of leaf nodes, the root node corresponds to an available resource, the leaf nodes correspond to a service requesting to invoke the available resource, the resource request count includes a request count of the root node of the local tree and a request count of each of the leaf nodes of the local tree, the request count of the root node is a sum of the request counts of each of the leaf nodes, the remote tree includes a root node and a plurality of leaf nodes, each of the nodes of the local tree corresponds one-to-one with each of the nodes of the remote tree, the resource usage count of the remote tree includes a usage count of the root node of the remote tree and a usage count of each of the leaf nodes of the remote tree, and the usage count of the root node of the remote tree is a sum of the usage counts of the leaf nodes of each of the remote tree.
In one possible implementation manner, the number of times of the resource call request is 1, the resource call request includes information of a target available resource and information of a target service, and the obtaining unit is configured to modify a resource request count of a local tree of the server, and includes:
The obtaining unit is configured to add 1 to a request count of a root node corresponding to a target available resource included in the local tree, and add 1 to a request count of a leaf node corresponding to a target service included in the root node corresponding to the target available resource.
In one possible implementation manner, the determining unit is specifically configured to calculate a sum of a request count of a root node corresponding to a target available resource of the local tree and a request count of a root node corresponding to the target available resource of the remote tree, to obtain a second count, if the second count is smaller than a root limit of the root node corresponding to the target available resource, the current limiting result is not current limiting, and if the second count is greater than or equal to the root limit of the root node corresponding to the target available resource, the current limiting result is current limiting.
In one possible implementation manner, the determining unit is specifically configured to calculate a sum of request counts of root nodes corresponding to target available resources of the local tree and request counts of root nodes corresponding to target available resources of the remote tree to obtain a second count, calculate a request count of leaf nodes corresponding to the target service of the local tree, and sum of leaf nodes corresponding to the target service of the remote tree to obtain a third count of leaf nodes corresponding to the target service, and if the second count is less than a root limit of root nodes corresponding to the target available resources and the third count is less than She Xiane of leaf nodes corresponding to the target service, the current limiting result is not current limiting, and if the second count is greater than or equal to a root limit of root nodes corresponding to the target available resources or the third count is greater than or equal to She Xiane of leaf nodes corresponding to the target service, the current limiting result is current limiting.
In one possible implementation, the existence time of the local tree and the remote tree is a current limiting unit time, and the root quota and the leaf quota of each leaf node are determined based on the resource request count of the local tree and the resource usage count of the remote tree in the historical current limiting unit time, wherein the root quota is the sum of the leaf quota of each leaf node.
In one possible implementation, each leaf node included in the local tree has a priority, and the leaf quota of each leaf node is determined based on the root quota and the priority of each leaf node, where the leaf quota of the leaf node is positively correlated with the priority of the leaf node.
In one possible implementation, the apparatus further includes:
and the sending unit is used for sending the local tree of the server to the database cluster according to the first frequency, wherein the local tree of the server is used for updating the resource use count of the database tree of the database cluster.
In one possible implementation, the apparatus further includes:
and the updating unit is used for acquiring the database tree according to the second frequency and updating the remote tree of the server by utilizing the database tree.
In a fourth aspect, the present application provides a current limiting processing apparatus, the apparatus being applied to a database cluster, the database cluster being connected to a flow control cluster, the apparatus comprising:
An obtaining unit, configured to obtain a local tree sent by a server included in the flow control cluster;
An updating unit, configured to update a database tree with the local tree, where a resource usage count of the database tree is a sum of resource request counts of the local trees of the respective servers;
and the sending unit is used for sending the database tree to a server included in the flow control cluster.
In a possible implementation manner, the local tree and the database tree only comprise one node, and the updating unit is specifically configured to add the resource request counts of the local trees to obtain the resource usage count of the database tree.
In one possible implementation, the local tree includes a root node and a plurality of leaf nodes, the resource request count includes a request count of the root node of the local tree and a request count of each of the leaf nodes of the local tree, the request count of the root node is a sum of the request counts of each of the leaf nodes, the database tree includes a root node and a plurality of leaf nodes, each node of the database tree corresponds to each node of the local tree one-to-one, and the resource usage count of the database tree includes a usage count of the root node of the database tree and a usage count of each of the leaf nodes of the database tree, and the usage count of the root node of the database tree is a sum of the usage counts of the leaf nodes of each of the database tree.
In one possible implementation manner, the updating unit is specifically configured to calculate a request count of a root node of each local tree and a sum of historical usage counts of the root node of the database tree, obtain an updated usage count of the root node of the database tree, calculate a historical usage count of a target leaf node of the database tree and a sum of request counts of leaf nodes of each local tree corresponding to the target leaf node of the database tree, obtain an updated usage count of the target leaf node of the database tree, where the target leaf node of the database tree is one of the leaf nodes included in the database tree.
In a fifth aspect, the present application provides an electronic device, comprising:
One or more processors;
a storage device having one or more programs stored thereon,
The one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of the first aspect, or the method of any of the second aspect.
In a sixth aspect, the present application provides a computer readable medium having stored thereon a computer program, wherein the program when executed by a processor implements the method of any of the first aspect, or the method of any of the second aspect.
In a seventh aspect, the application provides a computer program product which, when run on a device, causes the device to perform the method of the first aspect, or the method of any of the second aspects.
From this, the application has the following beneficial effects:
The application provides a current limiting processing method for a server included in a flow control cluster, and a current limiting processing method, device, equipment and storage medium applied to a database cluster. The flow control clusters are respectively connected with one database cluster and at least one service cluster. The method comprises the steps that a server obtains a resource calling request sent by a service cluster, modifies a resource request count of a local tree of the server, determines a current limiting result by utilizing the resource request count of the local tree and a resource use count of a remote tree of the server, and feeds back the current limiting result to the service cluster. The server interacts with the database cluster, sends a local tree to the database cluster, and obtains a database tree of the database cluster to update a remote tree of the server. The resource usage count of the remote tree is determined based on the resource usage count of the database tree of the database cluster, and the resource usage count is the sum of the resource request counts of the local trees of the servers included in the flow control cluster acquired by the database cluster. Therefore, the current limiting processing can be carried out locally, the decoupling of the current limiting processing and the database service is realized, the influence of the instability of the database service on the current limiting processing is avoided, the current limiting processing with higher stability is realized, and the current limiting delay is reduced.
Detailed Description
In order to facilitate understanding and explanation of the technical solutions provided by the embodiments of the present application, the following description will first explain the background art of the present application.
In the security audit service of the content, in order to audit various security items of various types of content, models for different types of content and different security items are required to be respectively called for audit. Thus, in the process of carrying out security audit on a large amount of contents, a large amount of models are required to be called for audit. Under the condition of limited model resources, the request for calling the model needs to be limited, so that the model can be ensured to normally provide service.
In the current throttling methods, redis (Remote Dictionary Server, remote dictionary service) is utilized to count the inventory of resources. The current limiting process is incompletely decoupled from the dis. In the event that the inventory (stocks) of locally recorded resources is sufficient, the local inventory is deducted and the request is subject to unlimited processing. In the event that local inventory is insufficient, it is necessary to wait for inventory to be pulled from Redis. Whether or not the current limit needs to be dependent on the inventory condition of the Redis feedback, the current limit process is affected by the Redis stability. Under the condition that Redis is unstable, the judgment of whether the request is limited or not is influenced, and the instability of the limitation is further caused.
Based on this, the embodiment of the application provides a current limiting processing method, a device, equipment and a storage medium, wherein the method is applied to a server included in a flow control (flow control) cluster, and the flow control cluster is respectively connected with a database cluster and at least one service cluster. The method comprises the steps of obtaining a resource calling request sent by a service cluster, modifying a resource request count of a local tree of a server, determining a current limiting result by utilizing the resource request count of the local tree and a resource use count of a remote tree of the server, and feeding back the current limiting result to the service cluster. The resource usage count of the remote tree is determined based on the resource usage count of the database tree of the database cluster, and the resource usage count is the sum of the resource request counts of the local trees of the servers included in the flow control cluster acquired by the database cluster. Therefore, the current limiting processing can be carried out locally, decoupling of processing requests and requesting resources from the database is realized, the influence of instability of database services on the current limiting processing is avoided, and the current limiting processing with higher stability is realized.
In order to facilitate understanding of a current limiting processing method provided by an embodiment of the present application, a description is given below of a current limiting processing method provided by an embodiment of the present application with reference to the accompanying drawings, and a description is given below of a scenario example shown in fig. 1 and fig. 2. Referring to fig. 1 and fig. 2, the fig. is a schematic diagram of a frame of an exemplary application scenario provided in an embodiment of the present application.
Those skilled in the art will appreciate that the frame diagrams shown in fig. 1 and 2 are merely examples of one in which embodiments of the present application may be implemented. The scope of applicability of the embodiments of the application is not limited in any way by the framework.
The embodiment of the application provides a current limiting processing method applied to a server included in a flow control cluster and a current limiting processing method applied to a database cluster. Referring to fig. 1, each flow control cluster is connected to one database cluster and a plurality of service clusters, respectively. The database clusters are, for example, distributed clusters, such as Redis clusters. Each service cluster can send a request to invoke a resource, i.e., a resource invocation request, to the flow control cluster. The flow control cluster is used for carrying out flow limiting management on the request of the service cluster. The flow control clusters are in one-to-one correspondence with the database clusters.
Referring to fig. 2, a flow control cluster includes a server 1 that creates a local tree and a remote tree in a local memory. Wherein the local tree includes a root node and a leaf node, the local tree having a resource request count. The resource request count is used to count the number of requests. The remote tree includes a root node and a leaf node. The remote tree includes a resource usage count. The resource usage count is used to count the number of resource uses. The resource usage count of the remote tree is determined based on the resource usage count of the database tree of the database cluster. The resource usage count of the database tree is obtained by counting the resource request count of the database cluster for the local tree of each server in the flow control cluster.
The server acquires a resource calling request sent by the service cluster, and modifies the resource request count of the local tree according to the request. The server transmits the local tree to the database cluster at a first frequency. The database cluster updates the database tree with the acquired local tree of each server included in the flow control cluster. And the database cluster sends the database tree to the server according to the second frequency. The server updates the remote tree with the obtained database tree. The server determines a current limit result by using the resource request count of the local tree and the resource use count of the remote tree, and feeds back the current limit result to the service cluster. The service cluster can determine whether the corresponding resource can be invoked based on the current limit result.
The method has the advantages that the local tree and the remote tree are built in the local memory of the server, the remote tree is updated asynchronously by utilizing the database tree of the database cluster, decoupling of the current limiting process and the database service can be realized, unstable current limiting process caused by unstable database service is avoided, and stability of the current limiting process is improved.
In order to facilitate understanding of the technical solution provided by the embodiments of the present application, the current limiting processing method applied to the server of the flow control cluster provided by the embodiments of the present application is described below with reference to the accompanying drawings. The current limiting processing method provided by the embodiment of the application is applied to the servers included in the flow control cluster. The flow control clusters are respectively connected with one database cluster and at least one service cluster. It should be noted that the current limit processing method can be applied to any instance of implementing a current limit service established based on the server.
Referring to fig. 3, the flow chart of a flow limiting processing method applied to a server of a flow control cluster according to an embodiment of the present application is shown in fig. 3, where the method may include S301 to S303:
s301, acquiring a resource call request sent by a service cluster, and modifying a resource request count of a local tree of a server.
In the process of processing the service, when the service cluster needs to call the resource, the service cluster triggers to send a resource call request to the flow control cluster. In one possible implementation, a service cluster that processes a resource call request is determined by an SDK (Software Development Kit ) of the flow control cluster according to a hash value of a resource name that the resource call request is to request to invoke. This enables resource call requests that call the same resource to be handled by the same service cluster.
The resource call request is used to request the resources required to call the processing service. As one example, the resource call request is an RPC (Remote Procedure Call ) request.
The embodiment of the application is not limited to the specific content included in the resource call request. As one example, a resource call request includes information about a resource that is requested to be called, and information about a service that uses the resource. The flow control cluster can allocate resource call requests to be processed to the servers based on the load conditions of the servers.
The local tree is pre-created in the local memory of the server. The resource request count of the local tree is used to record the condition of the resource request. For example, the resource request count for the local tree is QPS (Queries per second, query rate per second), or is per flow-limiting unit duration, i.e., number of queries per flow-limiting scale. The embodiment of the application limits the time length of the current limiting unit, namely the specific numerical value of the current limiting scale. Those skilled in the art can configure based on the need. As one example, the current limiting unit duration is 10 seconds. The prolonged current limiting unit duration is configured, so that the interaction frequency with database services can be reduced, and the accuracy of the current limiting method is improved.
It should be noted that the local tree can be created for each current limit unit duration. That is, the local tree of each current-limiting unit duration is created in advance before the start time of the current-limiting unit duration. The created local tree is used for recording the condition of the resource request in the time limit unit duration. After the end time of the current limiting unit duration, the local tree can be deleted or a preset time can be reserved so as to configure the quota of the subsequent current limiting unit duration.
In addition, embodiments of the present application do not limit the number of nodes included in the local tree. In one possible implementation, the local tree includes only one node. The node can be created for the available resources. The use of the local tree enables the throttling of requests to invoke the available resources. In another possible implementation, the local tree is a map structure. The local tree includes a root node and a plurality of leaf nodes. Referring to fig. 4, a schematic diagram of a local tree according to an embodiment of the present application is shown. The root node is created for the available resource and the leaf node corresponds to the service requesting to invoke the available resource. Different services can be embodied by different users sending resource call requests. The resource request count of the local tree includes a request count of a root node of the local tree and a request count of each leaf node of the local tree. The request count of the root node is the sum of the request counts of the individual leaf nodes. The local tree with the multi-node structure can realize the current limiting processing of the request for calling the available resource and realize the current limiting processing of the multi-service under the condition that the multi-service request calls the available resource.
After the server acquires the resource call request sent by the service cluster, the resource request count of the local tree is modified. In particular, the resource request count of the local tree can be modified with the counter of the local tree.
In the case where the local tree includes only one node, the resource request count for that node is modified. For example, the resource request count is incremented by 1 based on a request acquired this time.
In the case where the local tree includes a root node and a leaf node, the resource call request includes information of a target available resource and information of a target service. And modifying the request count of the root node corresponding to the target available resources included in the local tree and the request count of the leaf node corresponding to the target service included under the root node. For example, based on a request acquired this time, the request count of the root node corresponding to the target available resource included in the local tree is increased by 1, and the request count of the leaf node corresponding to the target service included in the root node is increased by 1.
S302, determining a current limit result by utilizing the resource request count of the local tree and the resource use count of the remote tree of the server.
The local memory of the server also pre-establishes a remote tree. The resource usage count of the remote tree is used to record the resource usage of the database cluster.
The remote tree is a mirror image of the database tree established for the database cluster. And the database tree of the database cluster is used for recording the resource request condition of each server of the flow control cluster. The resource usage count of the database tree is the sum of the resource request counts of the local trees of the individual servers included in the flow control cluster acquired by the database cluster. For a way to update the database tree of the database cluster, please refer to the following.
In one possible implementation, a database tree is obtained from a database cluster at a preset frequency, and a remote tree is updated with the database tree. As one example, the remote tree is overwritten with the database tree. The embodiment of the application does not limit the specific numerical value of the frequency of acquiring the database tree. For example, in the case of a current limit unit duration of 10 seconds, the database tree is acquired 1 time every 100 milliseconds in frequency. In the case of a high frequency of database tree acquisition, the remote tree in the server's local memory is infinitely similar to the database tree. Therefore, the remote tree can be used for more accurately carrying out the current limiting processing, decoupling with the database service can be realized, and the stability of the current limiting processing is ensured.
It should be noted that the remote tree can also be created for each current limit unit duration. That is, the local tree and the remote tree of each current-limiting unit duration are created in advance before the start time of the current-limiting unit duration. The created remote tree is used to record the resource usage within the current-limiting unit duration. After the end time of the current limit unit duration, the remote tree can be deleted or a preset time can be reserved to configure the quota of the subsequent current limit unit duration.
In addition, embodiments of the present application do not limit the number of nodes included in the remote tree. The remote tree is identical to the nodes comprised by the local tree. In one possible implementation, the local tree and the remote tree include only one node. In another possible implementation, the remote tree is a map structure. The remote tree includes a root node and a plurality of leaf nodes. Referring to fig. 5, a schematic diagram of a remote tree according to an embodiment of the present application is shown. The remote tree shown in fig. 5 corresponds to the local tree shown in fig. 4. Each node included in the remote tree corresponds to each node included in the local tree one by one. The resource usage count of the remote tree includes a usage count of a root node of the remote tree and a usage count of each leaf node of the remote tree. The usage count of the root node of the remote tree is the sum of the usage counts of the individual leaf nodes.
Whether the current request is limited can be judged according to the resource request count of the local tree and the resource use count of the remote tree.
As one possible implementation, the quota is pre-configured. The quota is used to represent the highest count that can invoke the resource. And when the resource request count, the resource use count or the sum of the resource request count and the resource use count is greater than or equal to the limit, determining that the current limit result is the current limit, and carrying out current limit processing on the current request.
The manner of determining whether to limit the current is different for different configurations of local and remote trees. The embodiments of the present application provide several specific implementations of determining the current limit result by using the resource request count of the local tree and the resource usage count of the remote tree of the server, which are described in detail below.
As another possible implementation, the resource request count and the resource usage count can be processed using a pre-trained artificial intelligence model to determine the current limit result. The artificial intelligence model can be trained beforehand using training samples. The training samples include a resource request count sample, a resource usage count sample, and a tag corresponding to the resource request count sample and the resource usage count sample. The label is a pre-labeled current limit result.
S303, feeding back a current limiting result to the service cluster which sends the resource calling request.
And after the current limiting result is determined, feeding back the current limiting result to the service cluster which sends the resource calling request. As an example, the current limit results in no current limit. The service cluster can invoke the corresponding resource based on the current limit result. As another example, the current limit results in a current limit. The service cluster is denied access to the corresponding resource.
Based on the above-mentioned content related to S301-S303, a local tree and a remote tree are built in the local memory of the server. The local tree can record the condition of the resource request. The remote tree is used as a mirror image of the database tree of the database cluster, so that the use condition of the resources of the database cluster can be embodied. After the server acquires the resource calling request, the judgment on whether the current limit is performed can be realized based on the local tree and the remote tree of the local memory. Therefore, the current limiting process is decoupled from the service provided by the database cluster, the stability of the database cluster does not influence the stability of the current limiting process, and the stable current limiting process is realized. In addition, the current limiting processing is realized based on the local tree and the remote tree in the local memory of the server, so that the current limiting processing efficiency can be improved, and the current limiting time delay can be reduced. Especially, aiming at the ultra-large flow scene, stable, low-delay and high-precision flow restriction can be realized.
The method for determining the current limiting result by utilizing the resource request count of the local tree and the resource use count of the remote tree is different for the local tree and the remote tree with different structures. As some examples, embodiments of the present application provide three specific implementations of determining a current limit result using a local tree's resource request count and a remote tree's resource usage count.
First, both the local tree and the remote tree include only one node.
In the case that the local tree and the remote tree have only one node, the sum of the resource request count of the local tree and the resource use count of the remote tree is calculated to obtain a first count. The first count is a count of resources that have been currently used and requested. If the first count is less than the resource limit, indicating that the currently used and requested resource does not exceed the limit, the current limit results in no current limit. If the first count is greater than or equal to the resource quota, indicating that the currently used and requested resource has exceeded the limit, the result of the throttling is a throttling. Wherein the resource quota is a preconfigured quota.
Second, the local tree and the remote tree each include a root node and a leaf node.
The request count of the root node of the local tree is the sum of the request counts of the individual leaf nodes. The usage count of the root node of the remote tree is the sum of the usage counts of the individual leaf nodes.
The request count of the root node of the local tree and the usage count of the root node of the remote tree can reflect the sum of the resources that have been currently used and requested. The resource call request acquired by the server comprises information of the target available resources and information of the target service.
And calculating the sum of the request count of the root node corresponding to the target available resource of the local tree and the request count of the root node corresponding to the target available resource of the remote tree to obtain a second count. The second count is a count of the target available resources that have been currently used and requested. The second count is compared to the root limit. The root quota is a quota preset for the count of the root node, and the resource limitation can be performed on the target available resources by using the root quota. The root quota is used to represent the total amount of resources available for the target. If the second count is less than the root limit, indicating that the currently used and requested target available resources do not exceed the total limit, the current limit results in a current limit. If the second count is greater than or equal to the root limit, indicating that the currently used and requested target available resources have exceeded a limit, the current limit results in a current limit.
Third, the local tree and the remote tree each include a root node and a leaf node.
The request count of the root node of the local tree is the sum of the request counts of the individual leaf nodes. The usage count of the root node of the remote tree is the sum of the usage counts of the individual leaf nodes.
The request count of the root node of the local tree and the usage count of the root node of the remote tree can reflect the sum of the resources that have been currently used and requested. The resource call request acquired by the server comprises information of the target available resources and information of the target service.
And calculating the sum of the request count of the root node corresponding to the target available resource of the local tree and the request count of the root node corresponding to the target available resource of the remote tree to obtain a second count. The second count is a count of available resources for the target that have been currently used and requested.
And calculating the request count of the leaf nodes corresponding to the target service of the local tree, and obtaining the third count by the sum of the leaf nodes corresponding to the target service of the remote tree. The third count is a count for the target traffic that has been currently used and requested.
And comparing the second count with the root quota of the root node corresponding to the target available resource, and comparing the third count with the leaf quota of the leaf node corresponding to the target service.
The root quota is a quota preset for the count of the root node corresponding to the target available resource, and the resource limitation can be carried out on the target available resource by utilizing the root quota. The root quota is used to represent the total amount of resources available for the target. The leaf quota is a quota preset for the count of leaf nodes corresponding to the target service for calling the target available resources, and the resource limitation can be carried out on the target service by utilizing the leaf quota. She Xiane are used to represent restrictions on invoking the target available resources for the target service.
If the second count is less than the root limit and the third count is less than She Xiane, indicating that the current target service has been used and that the requested target available resources do not exceed the limit, the result of the throttling is unrestricted. If the second count is greater than or equal to the root limit, indicating that the currently used and requested target available resources exceed the limit, the current limit results in a current limit. If the third count is greater than or equal to She Xiane, indicating that the target service has currently used and the requested target available resource exceeds the limit, the result of the throttling is a throttling. The root limit and the leaf limit are utilized to realize the flow limiting control of two dimensions of the resource and the service, and the flow limiting under the scene of calling the same resource for a plurality of service requests is realized.
It should be noted that, as one implementation, the root quota and the leaf quota can be fixed values that are configured in advance. Root and leaf limits can be configured based on the current limiting needs of resources and traffic. As another implementation, the existence time of the local tree and the remote tree is one current limiting unit time. The root quota and the leaf quota for each leaf node are determined based on the resource request count for the local tree and the resource usage count for the remote tree for the historical current limit unit time duration. Wherein the root quota is the sum of the leaf quota of each leaf node. The historical current limiting unit duration is specifically, for example, a current limiting unit duration that is the previous current limiting unit duration, or a plurality of current limiting unit durations. Based on the resource request count of the local tree and the resource use count of the remote tree in the historical current limiting unit time, the request and the use condition of the resources in the historical current limiting unit time can be determined, and then the specific numerical values of the root limit and the leaf limit in the current limiting unit time are determined.
As an example, based on the resource request count of the local tree and the resource usage count of the remote tree within the historical current unit time period, if an unlimited current can be determined, the root and leaf limits within the current unit time period can be either not adjusted or the values of the root and leaf limits within the current unit time period can be reduced. If it can be determined that the current limit has been exceeded, the values of the root and leaf limits for the current unit duration can be increased. The added value can be a preset added step length, or an added step length corresponding to a value that the resource request count of the local tree and the resource use count of the remote tree exceed the limit in the historical current limiting unit duration.
Further, the priorities of the available resources of different service requests may be different, and each leaf node included in the local tree has a priority of the corresponding available resources of the service request. After the root quota is determined, the leaf quota of each leaf node is determined according to the priority of each leaf node. In one possible implementation, she Xiane of the leaf nodes are positively correlated with the priority of the leaf nodes. Higher priority leaves are higher in quota. Lower priority leaves are lower in quota.
In another possible implementation, the requirements of resource usage and requests of higher priority leaf nodes are satisfied first, and the requirements of resource usage and requests of lower priority leaf nodes are reconfigured. For leaf nodes of the same priority, the leaf quota of the leaf node can be the same.
As an example, referring to fig. 6, a schematic diagram of quota allocation for a local tree is provided in an embodiment of the present application. The root node includes 4 leaf nodes. The root quota of the root node is 10000. The priority of the leaf node 1 is 1 level at the highest, the priority of the leaf node 2 and the leaf node 3 is 2 level at the next highest, and the priority of the leaf node 4 is 3 level at the lowest. The sum of the resource request count and the resource usage count in the historical current limit unit time length of the leaf node 1 is 7000, that is, the demand for calling resources in the historical current limit unit time length of the leaf node 1 is 7000. The sum of the resource request count and the resource usage count within the historical current limit unit duration of leaf node 2 is 2500. The sum of the resource request count and the resource usage count within the historic current limit unit duration of the leaf node 3 is 1500. The sum of the resource request count and the resource usage count within the historic current limit unit duration of the leaf node 4 is 1000. Leaf node 1 is assigned a leaf quota of value 7000. Leaf limits of 1500 are assigned to leaf node 2 and leaf node 3, respectively. Leaf node 3 is assigned a leaf quota of 0.
Determining the leaf quota using the priority enables dynamic allocation of the leaf quota. The leaf quota thus obtained can more meet the requirement of service request resources, reasonable allocation of the quota is realized, and limited resources are utilized to a greater extent.
In addition, it should be noted that, the method for determining whether the limit is exceeded by using the limit provided by the embodiment of the application can reduce the condition of current limiting in advance, reduce the possibility of misjudging the current limiting, and improve the accuracy of current limiting.
The above is a specific implementation of the server of the flow control cluster to determine if the limit is exceeded or not and to determine the limit is possible. In some implementations, the flow control cluster includes a server that sends a local tree of the server to the database cluster at a frequency. The embodiment of the application does not limit the specific value of the frequency of transmitting the local tree. For example, in the case where the current limit unit duration is 10 seconds, the frequency is 1 local tree per 200 milliseconds.
The server sends a local tree to the database cluster for updating the resource usage count of the database tree of the database cluster.
Correspondingly, the embodiment of the application also provides a current limiting processing method applied to the database cluster. The database cluster is connected with the flow control cluster. Referring to fig. 7, which is a flowchart of a current limiting processing method applied to a database cluster according to an embodiment of the present application, as shown in fig. 7, the method may include S701-S703.
And S701, acquiring a local tree sent by a server included in the flow control cluster.
The flow control cluster includes a plurality of servers. Each server included in the flow control cluster sends a local tree to the database cluster according to a certain frequency. The database cluster acquires a local tree sent by each server.
S702, updating a database tree by using the local tree, wherein the resource use count of the database tree is the sum of the resource request counts of the local tree of each server.
The database cluster builds a database tree in advance. As one example, a database tree is built for each type of available resource. The resource usage count of the database tree is used to count the already used resources determined based on the flow control cluster. The resource use count of the database tree is obtained by superposing the resource request count of the local tree of each server acquired by the database cluster. That is, the database tree is augmented by local trees acquired by the database cluster. The way in which the database tree is updated is different for the local tree and database tree of servers of different structures. The embodiments of the present application provide two methods for updating database trees, please refer to the following.
And S703, sending the database tree to a server included in the flow control cluster.
The database cluster can also send a database tree to a server of the flow control cluster. The server is thus able to update the remote tree of the server with the acquired database tree.
In one possible implementation, a server of a flow control cluster sends a query request to a database cluster. In response to a query request to obtain the database tree, the database cluster feeds back the database tree to the server. In another possible implementation, the frequency at which the database clusters send the database tree is preconfigured. The database cluster sends a database tree to each server of the flow control cluster according to the frequency.
Based on the knowledge of S701-S703, the flow control cluster and the database cluster interact to implement the flow limiting process and service decoupling provided by the database cluster. Therefore, the stability of the database cluster does not influence the stability of the current limiting process, and the stable current limiting process is realized.
In one possible implementation, the local tree and the database tree include only one node. And updating the database tree by using the local tree, specifically adding the resource request counts of each local tree to obtain the resource use count of the database tree.
In another possible implementation, the local tree includes a root node and a plurality of leaf nodes. The resource request count of the local tree includes a request count of a root node of the local tree and a request count of each leaf node of the local tree. The request count of the root node is the sum of the request counts of the individual leaf nodes. Correspondingly, the database tree comprises a root node and a plurality of leaf nodes. Each node of the database tree corresponds to each node of the local tree one by one. The resource usage count of the database tree includes a usage count of a root node of the database tree and a usage count of each leaf node of the database tree. The usage count of the root node of the database tree is the sum of the usage counts of the leaf nodes of the respective database tree.
In the case where the local tree and the database tree each include a root node and a leaf node, the database tree is updated with the local tree, including an update of the usage count of the root node of the database tree and an update of the usage count of each leaf node.
And for updating the usage count of the root node of the database tree, calculating the request count of the root node of each local tree and the sum of the historical usage counts of the root nodes of the database tree to obtain the updated usage count of the root node of the database tree. It should be noted that, as an example, the initial usage count of the root node of the database tree that is initially created is an initial value. The initial value is, for example, 0.
For updating the usage count of each leaf node of the database tree, calculating a historical usage count of the leaf nodes of the database tree and a sum of the request counts of the corresponding leaf nodes of the respective local trees, and obtaining the updated usage count of the target leaf node of the database tree. It should be noted that, as an example, the initial usage count of each leaf node of the database tree that is initially created is an initial value. The initial value is, for example, 0.
Based on the method provided by the embodiment of the method, the embodiment of the application also provides a current limiting processing device applied to the server of the flow control cluster. The device is applied to a server included in a flow control cluster, and the flow control cluster is respectively connected with one database cluster and at least one service cluster. A flow restriction processing device applied to a server of a flow control cluster will be described with reference to the accompanying drawings.
Referring to fig. 8, the schematic structural diagram of a current limiting processing device applied to a server of a flow control cluster according to an embodiment of the present application is shown. As shown in fig. 8, the current limiting processing apparatus applied to a server of a flow control cluster includes:
An obtaining unit 801, configured to obtain a resource call request sent by the service cluster, and modify a resource request count of a local tree of the server;
A determining unit 802, configured to determine a current limiting result by using a resource request count of the local tree and a resource usage count of a remote tree of the server, where the resource usage count of the remote tree is determined based on a resource usage count of a database tree of the database cluster, and the resource usage count is a sum of resource request counts of local trees of respective servers included in the flow control cluster acquired by the database cluster;
and the feedback unit 803 is configured to feed back the current limiting result to the service cluster that sends the resource calling request.
In one possible implementation manner, the local tree and the remote tree each include only one node, and the determining unit 802 is specifically configured to calculate a sum of a resource request count of the local tree and a resource usage count of the remote tree to obtain a first count, if the first count is less than a resource limit, the current limiting result is not current limiting, and if the first count is greater than or equal to the resource limit, the current limiting result is current limiting.
In one possible implementation, the local tree includes a root node and a plurality of leaf nodes, the root node corresponds to an available resource, the leaf nodes correspond to a service requesting to invoke the available resource, the resource request count includes a request count of the root node of the local tree and a request count of each of the leaf nodes of the local tree, the request count of the root node is a sum of the request counts of each of the leaf nodes, the remote tree includes a root node and a plurality of leaf nodes, each of the nodes of the local tree corresponds one-to-one with each of the nodes of the remote tree, the resource usage count of the remote tree includes a usage count of the root node of the remote tree and a usage count of each of the leaf nodes of the remote tree, and the usage count of the root node of the remote tree is a sum of the usage counts of the leaf nodes of each of the remote tree.
In a possible implementation manner, the number of times of the resource call request is 1, the resource call request includes information of a target available resource and information of a target service, and the obtaining unit 801 is configured to modify a resource request count of a local tree of the server, and includes:
The obtaining unit 801 is configured to increment a request count of a root node corresponding to a target available resource included in the local tree by 1, and increment a request count of a leaf node corresponding to a target service included in the root node corresponding to the target available resource by 1.
In one possible implementation manner, the determining unit 802 is specifically configured to calculate a sum of a request count of a root node corresponding to a target available resource of the local tree and a request count of a root node corresponding to the target available resource of the remote tree, to obtain a second count, where if the second count is less than a root quota of the root node corresponding to the target available resource, the current limiting result is no current limitation. And if the second count is greater than or equal to the root limit of the root node corresponding to the target available resource, the current limiting result is current limiting.
In one possible implementation manner, the determining unit 802 is specifically configured to calculate a sum of request counts of root nodes corresponding to target available resources of the local tree and request counts of root nodes corresponding to target available resources of the remote tree to obtain a second count, calculate a sum of request counts of leaf nodes corresponding to the target service of the local tree and leaf nodes corresponding to the target service of the remote tree to obtain a third count of leaf nodes corresponding to the target service, and if the second count is less than a root limit of the root nodes corresponding to the target available resources and the third count is less than She Xiane of leaf nodes corresponding to the target service, the current limiting result is no current limiting, and if the second count is greater than or equal to a root limit of the root nodes corresponding to the target available resources or the third count is greater than or equal to She Xiane of leaf nodes corresponding to the target service, the current limiting result is current limiting.
In one possible implementation, the existence time of the local tree and the remote tree is a current limiting unit time, and the root quota and the leaf quota of each leaf node are determined based on the resource request count of the local tree and the resource usage count of the remote tree in the historical current limiting unit time, wherein the root quota is the sum of the leaf quota of each leaf node.
In one possible implementation, each leaf node included in the local tree has a priority, and the leaf quota of each leaf node is determined based on the root quota and the priority of each leaf node, where the leaf quota of the leaf node is positively correlated with the priority of the leaf node.
In one possible implementation, the apparatus further includes:
and the sending unit is used for sending the local tree of the server to the database cluster according to the first frequency, wherein the local tree of the server is used for updating the resource use count of the database tree of the database cluster.
In one possible implementation, the apparatus further includes:
and the updating unit is used for acquiring the database tree according to the second frequency and updating the remote tree of the server by utilizing the database tree.
Based on the current limiting processing method applied to the database cluster provided by the embodiment of the method, the embodiment of the application also provides a current limiting processing device applied to the database cluster. The device is applied to a database cluster, and the database cluster is connected with a flow control cluster. The current limiting processing device applied to the database cluster will be described with reference to the accompanying drawings.
Referring to fig. 9, the schematic structural diagram of a current limiting processing device applied to a database cluster according to an embodiment of the present application is shown. As shown in fig. 9, the current limiting processing apparatus applied to a database cluster includes:
an obtaining unit 901, configured to obtain a local tree sent by a server included in the flow control cluster;
an updating unit 902, configured to update a database tree with the local tree, where a resource usage count of the database tree is a sum of resource request counts of the local trees of the respective servers;
a sending unit 903, configured to send the database tree to a server included in the flow control cluster.
In a possible implementation manner, the local tree and the database tree include only one node, and the updating unit 902 is specifically configured to add the resource request counts of the local trees to obtain the resource usage count of the database tree.
In one possible implementation, the local tree includes a root node and a plurality of leaf nodes, the resource request count includes a request count of the root node of the local tree and a request count of each of the leaf nodes of the local tree, the request count of the root node is a sum of the request counts of each of the leaf nodes, the database tree includes a root node and a plurality of leaf nodes, each node of the database tree corresponds to each node of the local tree one-to-one, and the resource usage count of the database tree includes a usage count of the root node of the database tree and a usage count of each of the leaf nodes of the database tree, and the usage count of the root node of the database tree is a sum of the usage counts of the leaf nodes of each of the database tree.
In a possible implementation manner, the updating unit 902 is specifically configured to calculate a sum of a request count of a root node of each local tree and a historical usage count of the root node of the database tree, obtain an updated usage count of the root node of the database tree, calculate a historical usage count of a target leaf node of the database tree, and calculate a sum of a request count of a leaf node of each local tree corresponding to the target leaf node of the database tree, obtain an updated usage count of the target leaf node of the database tree, where the target leaf node of the database tree is one of the leaf nodes included in the database tree.
The application further provides electronic equipment, which comprises one or more processors and a storage device, wherein one or more programs are stored in the storage device, and when the one or more programs are executed by the one or more processors, the one or more processors realize the flow limiting processing method applied to the servers of the flow control cluster or the flow limiting processing method applied to the database cluster.
Referring now to fig. 10, a schematic diagram of an electronic device 1000 suitable for use in implementing embodiments of the present application is shown. The terminal device in the embodiment of the present application may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (Personal DIGITAL ASSISTANT ), a PAD (Portable android device, a tablet computer), a PMP (Portable MEDIA PLAYER, a Portable multimedia player), a car-mounted terminal (e.g., a car navigation terminal), and the like, and a fixed terminal such as a digital TV (television), a desktop computer, and the like. The electronic device shown in fig. 10 is merely an example, and should not impose any limitation on the functionality and scope of use of embodiments of the present application.
As shown in fig. 10, the electronic device 1000 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 1001 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 1002 or a program loaded from a storage means 1008 into a Random Access Memory (RAM) 1003. In the RAM1003, various programs and data necessary for the operation of the electronic apparatus 1000 are also stored. The processing device 1001, the ROM 1002, and the RAM1003 are connected to each other by a bus 1004. An input/output (I/O) interface 1005 is also connected to bus 1004.
In general, devices including input devices 1008 such as touch screens, touch pads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc., output devices 1007 including Liquid Crystal Displays (LCD), speakers, vibrators, etc., storage devices 1008 including magnetic tape, hard disk, etc., and communication devices 1009 may be connected to the I/O interface 1005. The communication means 1009 may allow the electronic device 1000 to communicate wirelessly or by wire with other devices to exchange data. While fig. 10 shows an electronic device 1000 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present application, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication device 1009, or installed from the storage device 1008, or installed from the ROM 1002. When being executed by the processing means 1001, performs the above-described functions defined in the method of the embodiment of the present application.
The electronic device provided by the embodiment of the present application belongs to the same inventive concept as the current limiting processing method applied to the server of the flow control cluster or the current limiting processing method applied to the database cluster provided by the above embodiment, and technical details not described in detail in the present embodiment can be seen from the above embodiment, and the present embodiment has the same beneficial effects as the above embodiment.
Based on the current limiting processing method applied to the server of the flow control cluster and the current limiting processing method applied to the database cluster provided in the above method embodiments, the embodiment of the application provides a computer storage medium, on which a computer program is stored, wherein the program when executed by a processor implements the current limiting processing method applied to the server of the flow control cluster or the current limiting processing method applied to the database cluster as described in any one of the embodiments.
The computer readable medium of the present application may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor apparatus or device, or a combination of any of the foregoing. More specific examples of a computer-readable storage medium may include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution apparatus or device. In the present application, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution apparatus or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to electrical wiring, fiber optic cable, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (Hyper Text Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be included in the electronic device or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to perform the above-described flow-limiting processing method applied to the server of the flow control cluster or the flow-limiting processing method applied to the database cluster.
Computer program code for carrying out operations of the present application may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present application may be implemented in software or in hardware. The name of the unit/module is not limited to the unit itself in some cases, and, for example, the voice data acquisition module may also be described as a "data acquisition module".
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic that may be used include Field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems-on-a-chip (SOCs), complex Programmable Logic Devices (CPLDs), and the like.
In the context of the present application, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution apparatus or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor devices or apparatuses, or any suitable combination of the above. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
It should be noted that, in the present description, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different manner from other embodiments, and identical and similar parts between the embodiments are all enough to refer to each other. For the system or device disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the relevant points refer to the description of the method section.
It should be understood that in the present application, "at least one (item)" means one or more, and "a plurality" means two or more. "and/or" is used to describe an association relationship of an associated object, and indicates that three relationships may exist, for example, "a and/or B" may indicate that only a exists, only B exists, and three cases of a and B exist simultaneously, where a and B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one of a, b or c may represent a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
It is further noted that 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 an element.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.