Method, device and storage medium for calling multiple data sources
By constructing original tree samples and forming a decision tree based on roulette weights and priorities, the problem of resource waste and maintenance difficulties in calling multiple data sources is solved, the selection of better data sources and service calling are realized, and the user experience is improved.
Patent Information
- Application Number
- CN202310953926.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-31
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2043-07-31
AI Technical Summary
In multi-data source calling scenarios, existing technology cannot intelligently select data sources with better performance and price, resulting in resource waste and maintenance difficulties.
By constructing original tree samples, a decision tree is formed based on the routing information, roulette weight and priority of the data source to achieve optimal selection of multi-dimensional data sources.
It saves costs, improves user experience, and enables better data source selection and service invocation.
Smart Images

Figure CN117082151B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of calling multiple data sources, and in particular to a method, device and storage medium for calling multiple data sources. Background Art
[0002] In some scenarios where multiple data sources are called, such as the authentication scenario of user real-name information, there are many ways, such as the three elements of personal information (name, ID card, phone number), the four elements of image personal information (name, ID card, phone number, portrait image information), the two elements of user (name, mobile phone number), etc. For the service provider's server-side equipment, there are many sources of authentication data for the same capability, such as the three elements of personal information, such as telecommunications companies and mobile companies in the market.
[0003] The existing technical solution is to provide real-name authentication services by generating a service call port, that is, a "many-to-many" format. In this format, it is impossible to intelligently select a data source with better price, performance, etc., and only a single call to a specific data source can be made. Summary of the invention
[0004] The present application provides a method, device and system for calling multiple data sources to realize intelligent calling of multiple data sources. The technical solution of the present application is as follows:
[0005] In a first aspect, an embodiment of the present application provides a method for calling multiple data sources, including:
[0006] In response to a product service request, obtaining request parameter information carried in the product service request; and determining a first product that satisfies the product service request based on the request parameter information;
[0007] Obtaining routing information of the first product in the original tree sample, and determining the product type of the first product based on the routing information; wherein the product type includes a combination product and a single product; the original tree sample is constructed with services, products and data sources as root nodes, branch nodes and leaf nodes respectively; the child nodes of the combination product are combination products or single products, and the child nodes of the single product are data sources;
[0008] In the case where the product type of the first product is a component product, addressing the single products associated with the first product in the original tree sample one by one, and performing the following steps on the single products until the product service request response ends;
[0009] Acquire multiple data sources associated with the single product, and perform a roulette weight decision on the multiple data sources to determine an initial priority of each of the multiple data sources;
[0010] Based on the initial priority of each data source among the multiple data sources and the relevant calling information of each data source, the selection probability of each data source is obtained; and based on the selection probability of the multiple data sources, the target data source among the multiple data sources is determined and called.
[0011] In some implementations, the method further includes:
[0012] In the case where the product type of the first product is a single product, multiple data sources associated with the single product are obtained; and a roulette weight decision is performed on the multiple data sources to determine an initial priority of each of the multiple data sources;
[0013] Based on the initial priority of each data source among the multiple data sources and the relevant calling information of each data source, the selection probability of each data source is obtained; and based on the selection probability of the multiple data sources, the target data source among the multiple data sources is determined and called.
[0014] In some implementations, performing a roulette wheel weight decision on the multiple data sources to determine an initial priority of each of the multiple data sources includes:
[0015] For each data source among the plurality of data sources, calculating a roulette weight of each data source;
[0016] Based on the roulette weights of the multiple data sources, obtaining the roulette weight ratio of each data source;
[0017] Determine the roulette area of each data source based on the roulette weight ratio and the preset roulette mechanism;
[0018] Randomly generate a natural number based on the preset roulette mechanism, and determine the roulette area where the natural number is located in the preset roulette mechanism;
[0019] Based on the roulette area where the natural number is located, an initial priority of each data source among the multiple data sources is determined.
[0020] In some implementations, calculating the roulette weight of each data source includes:
[0021] Based on the price and call latency of each data source, a roulette weight of each data source is calculated.
[0022] In some implementations, after determining and calling a target data source among the multiple data sources, the method further includes:
[0023] Determine whether the target data source is successfully called;
[0024] In the case that the target data source is not successfully called, calculating the selection probability of each alternative data source among the multiple data sources except the target data source;
[0025] Based on the selection probabilities of the alternative data sources, a new target data source is determined and called.
[0026] In some implementations, calculating the selection probability of each data source other than the target data source among the multiple data sources includes:
[0027] Based on the preset data source selection rule, the selection probability of each data source among the multiple data sources except the target data source is calculated.
[0028] In some implementations, the acquiring the selection probability of each data source based on the initial priority of each data source among the multiple data sources and the related call information of each data source includes:
[0029] Based on the initial priority of each data source among the multiple data sources, the pheromone between each data source and the first product, and the call delay of each data source, the selection probability of each data source is obtained.
[0030] In some implementations, after obtaining the multiple data sources associated with the single product, the method further includes:
[0031] Based on the data source blacklist, the multiple data sources are screened to obtain multiple data sources suitable for the first product.
[0032] In a second aspect, an embodiment of the present application provides a device for calling multiple data sources, including:
[0033] A data parsing module, configured to obtain, in response to a product service request, request parameter information carried in the product service request; and determine, based on the request parameter information, a first product that satisfies the product service request;
[0034] a product type determination module, configured to obtain routing information of the first product in the original tree sample, and determine the product type of the first product based on the routing information; wherein the product types include combined products and single products; the original tree sample is constructed with services, products and data sources as root nodes, branch nodes and leaf nodes respectively; the child nodes of the combined product are combined products or single products, and the child nodes of the single product are data sources;
[0035] A process control module, configured to, when the product type of the first product is a component product, address the single product associated with the first product in the original tree sample one by one, and perform the following steps on the single product until the product service request response is completed;
[0036] A roulette decision module, used to obtain multiple data sources associated with the single product, and perform a roulette weight decision on the multiple data sources to determine the initial priority of each data source in the multiple data sources;
[0037] A target determination module is used to obtain the selection probability of each data source among the multiple data sources based on the initial priority of each data source and the relevant calling information of each data source; and determine and call the target data source among the multiple data sources based on the selection probability of the multiple data sources.
[0038] In some implementations, the roulette decision module is further configured to:
[0039] In the case where the product type of the first product is a single product, multiple data sources associated with the single product are obtained; and a roulette weight decision is performed on the multiple data sources to determine an initial priority of each of the multiple data sources;
[0040] A target determination module is used to obtain the selection probability of each data source among the multiple data sources based on the initial priority of each data source and the relevant calling information of each data source; and determine and call the target data source among the multiple data sources based on the selection probability of the multiple data sources.
[0041] In some implementations, the roulette decision module is specifically configured to:
[0042] For each data source among the plurality of data sources, calculating a roulette weight of each data source;
[0043] Based on the roulette weights of the multiple data sources, obtaining a roulette weight ratio of each data source;
[0044] Determine the roulette area of each data source based on the roulette weight ratio and the preset roulette mechanism;
[0045] Randomly generate a natural number based on the preset roulette mechanism, and determine the roulette area where the natural number is located in the preset roulette mechanism;
[0046] Based on the roulette area where the natural number is located, an initial priority of each data source among the multiple data sources is determined.
[0047] In some implementations, the roulette decision module, when calculating the roulette weight of each data source, is used to:
[0048] Based on the price and call latency of each data source, a roulette weight of each data source is calculated.
[0049] In some implementations, the apparatus further includes:
[0050] A result judgment module is used to judge whether the target data source is successfully called;
[0051] The alternative calculation module is used to calculate the selection probability of each alternative data source other than the target data source among the multiple data sources when the target data source is not successfully called; and determine and call a new target data source based on the selection probability of each alternative data source.
[0052] In some implementations, when calculating the selection probability of each data source other than the target data source among the multiple data sources, the alternative calculation module is specifically configured to:
[0053] Based on the preset data source selection rule, the selection probability of each data source among the multiple data sources except the target data source is calculated.
[0054] In some implementations, when the target determination module obtains the selection probability of each data source based on the initial priority of each data source among the multiple data sources and the relevant call information of each data source, it is used to:
[0055] Based on the initial priority of each data source among the multiple data sources, the pheromone between each data source and the first product, and the call delay of each data source, the selection probability of each data source is obtained.
[0056] In some implementations, after obtaining multiple data sources associated with the single product, the roulette decision module is further configured to:
[0057] Based on the data source blacklist, the multiple data sources are screened to obtain multiple data sources suitable for the first product.
[0058] In a third aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the calling method of multiple data sources described in the embodiment of the first aspect of the present application.
[0059] In a fourth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the method for calling multiple data sources described in the embodiment of the first aspect of the present application.
[0060] In a fifth aspect, an embodiment of the present application provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the method for calling multiple data sources described in the embodiment of the first aspect of the present application.
[0061] The technical solution provided by the embodiments of the present application brings at least the following beneficial effects:
[0062] The original tree samples are constructed based on the combination products, single products and data sources. The decision tree samples are formed by adding attributes such as roulette weights and priorities based on the routing information of the data source. The optimal selection of the data source is realized based on the decision tree samples. In the process of forming the decision tree, the roulette weight of the data source is obtained based on comprehensive factors such as the performance and price of the data source. The initial priority of the data source is determined based on the roulette weight. Then, the final priority of the data source is obtained in combination with other call-related factors of the data source. The optimal call of the multi-dimensional data source is realized based on the final priority. Based on the decision tree, the multiple dimensions of the data source can be better analyzed comprehensively, so as to select a better data source for service call. To a certain extent, it saves costs and improves user experience.
[0063] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application, and do not constitute an improper limitation on the present application.
[0065] Figure 1 The present invention is a flowchart of a method for calling multiple data sources according to an exemplary embodiment.
[0066] Figure 2 is a schematic diagram of an original tree sample according to an exemplary embodiment.
[0067] Figure 3 The figure is a flowchart of a method for calling multiple data sources according to another exemplary embodiment.
[0068] Figure 4 The figure is a flowchart of a method for calling multiple data sources according to another exemplary embodiment.
[0069] Figure 5 The figure is a flowchart of a method for calling multiple data sources according to another exemplary embodiment.
[0070] Figure 6 The present invention is a block diagram of a device for calling multiple data sources according to an exemplary embodiment.
[0071] Figure 7 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0072] In order to enable ordinary persons in the art to better understand the technical solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0073] It should be noted that the terms "first", "second", etc. in this application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the application described here can be implemented in an order other than those illustrated or described here. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0074] The real-name authentication service provides a safe and reliable user information maintenance service for external application registration and login through character information comparison and verification. There are two scenarios for the real-name authentication service.
[0075] Scenario 1: One capability is associated with multiple capabilities. For example, the four elements of the person information in the picture are composed of the three elements of the person information (name, ID card, phone number) and the three elements of the image information (name, ID card, image). After the three elements of the person information are successfully authenticated, the image information, name, and ID card information are taken to verify the three elements of the image, and the two results are combined and returned.
[0076] Scenario 2: A capability is associated with multiple data sources. For example, the three elements of personal information (name, ID card, and phone number) can be composed of multiple authentication databases such as the telecommunications number database, the mobile number database, and the Unicom number database. Decisions can be made based on comprehensive factors such as price and performance. The ones with high priority will be called first, and if the call fails, they will be called in sequence.
[0077] For the above two scenarios, the following relevant dimensions can be subdivided.
[0078] Product dimension: Real-name authentication can be divided into many products, including three elements of operators (mobile phone + name + ID card), three elements of portrait (name + ID card + portrait), two elements of operators (mobile phone + name), two elements of identity (ID card + name), four elements of operators (mobile phone + name + ID card + portrait), etc. The more dimensions of a product, the more capabilities it represents. When consuming, the capability value must be applied for before billing and settlement can be carried out.
[0079] Data source dimension: In the same way, a product includes a series of data sources. For example, the three elements of character information can be composed of multiple data sources, and each data source belongs to a separate individual. If the product is a company, then the data source is the soldiers in the company.
[0080] Data source company dimension (small impact): Each company has data sources with different capabilities. In order to settle them, they also need to be managed in a unified manner.
[0081] In view of the above situation, the first technical problem we need to face is that it is difficult to call scenarios in different dimensions. The first problem we need to face is: many-to-many. For each product dimension, a calling service interface is opened. When the number of product dimensions is too large, the number of service calling ports opened also increases. This greatly increases the labor cost, and it is also inconvenient to maintain the entire service system, wasting most of the labor resources, increasing the monitoring cost, and is not conducive to problem troubleshooting.
[0082] In order to solve the above problems, an embodiment of the present application provides a method for calling multiple data sources, so as to comprehensively select appropriate data sources from multiple dimensions for calling.
[0083] Figure 1 1 is a flowchart of a method for calling multiple data sources according to an embodiment of the present application. It should be noted that the method for calling multiple data sources according to an embodiment of the present application can be applied to a device for calling multiple data sources according to an embodiment of the present application. The device for calling multiple data sources can be configured on an electronic device. Figure 1 As shown, the calling method of the multi-data source may include the following steps.
[0084] In step S101, in response to a product service request, request parameter information carried in the product service request is obtained; and a first product satisfying the product service request is determined based on the request parameter information.
[0085] As an example, a user transmits a product service request (such as a real-name authentication request) carrying request parameter information to the preset data source calling system. The preset data source calling system parses the request parameter information and obtains product information as the first product, such as the four elements of the operator, and submits the product information to the routing system. The functions of the routing system are described in detail in the following steps.
[0086] In step S102, the routing information of the first product in the original tree sample is obtained, and based on the routing information, the product type of the first product is determined; wherein the product type includes a combination product and a single product; the original tree sample is constructed with services, products and data sources as root nodes, branch nodes and leaf nodes respectively; the child nodes of the combination product are the combination product or the single product, and the child nodes of the single product are the data sources.
[0087] It should be noted that, in this embodiment, products are subdivided into combined products and single products according to business needs, and the original tree samples are constructed with services, products and data sources as root nodes, branch nodes and leaf nodes respectively. The original tree samples need to be constructed in advance. In one implementation, routing information is configured for the combined product, single product and data source samples to form the original tree samples, such as Figure 2 As shown. The root node is a service, such as a real-name authentication service. Among them, the branch nodes of the original tree sample are products. Products can be combination products or single products. The child nodes under the combination products can be combination products or single products. The child nodes of single products are leaf nodes, and leaf nodes correspond to data sources. Each single product may correspond to multiple data sources. Each combination product may be split into multiple single products.
[0088] For example, the four elements of an operator are a combination product, including two sub-nodes that are single products, namely the three elements of an operator and the three elements of a portrait. The three elements of an operator and the three elements of a portrait both include multiple data sources.
[0089] As an implementation method, a label number is configured for each data source in the original tree sample; wherein, the label number is configured for the data source mainly to facilitate the management of the data source. For example, it can be configured as: data source 1, data source 2, data source 3, etc. At the same time, it is also convenient to add roulette weight attributes according to the relevant label number in subsequent work.
[0090] Single product splitting: A single product is a branch node, and its leaf nodes are composed of data sources; a combination product can be composed of a single product, a combination of products, or a single and combination of products.
[0091] After determining the first product that meets the product service request in the above step, the routing information of the first product in the original tree sample can be queried, for example, the routing information of the first product can be queried according to the routing configuration information table to obtain the routing information of the first product.
[0092] As an implementation method, the routing system configures the tree-like routing information of products and data sources, and in the subsequent processing, adds attribute information such as wheel weight, priority, blacklist and whitelist to the routing information to form a decision tree. The routing system also implements routing mining, i.e. splitting, for each product.
[0093] In step S103, when the product type of the first product is a component product, the single products associated with the first product in the original tree sample are addressed one by one, and the following steps are performed for the single product until the product service request response is completed.
[0094] The first product may be a combination product or a single product. If it is a single product, the single product is split to decompose multiple data sources applicable to this product service request, and then the subsequent multiple data sources are selected and called.
[0095] If it is a combination product, the combination product is split, and routing data mining is performed to mine the subnodes of the combination product and the next-level subnodes until it is split into a single product. That is, a recursive algorithm is used to poll each single product of the combination product. In other words, the single products under the combination product are obtained one by one through layer-by-layer splitting; the single product is split to obtain the data source. For example, if the combination product includes 3 subnodes, and all 3 subnodes are single products, the 3 single products are split one by one to obtain the data source and perform subsequent processing.
[0096] Taking the real-name authentication service as an example, one case where the product service request response ends is that the user's multiple user information is verified and the authentication is successful, that is, the data source of each single product associated with the corresponding combination product is successfully called after subsequent processing, and the process ends, or the routing system determines that the process ends. Another case where the product service request response ends is that the authentication fails. For example, when verifying the mobile phone number, if the verification fails, the following image verification process will not be performed and the process ends.
[0097] In step S104, multiple data sources associated with the single product are obtained, and a roulette wheel weight decision is performed on the multiple data sources to determine the initial priority of each of the multiple data sources.
[0098] It should be noted that during the use of data sources, there may be many situations such as the data source expiring or the data source provider raising prices. After these situations occur, the corresponding data source may not be called. Therefore, before selecting a data source, you need to remove the data source that cannot be called.
[0099] As an implementation method, a data source blacklist and / or a data source whitelist may be set and updated in real time to ensure that the data sources for subsequent processing are all currently available data sources. For example, the fact that a data source belongs to a whitelist and / or a blacklist may be used as an attribute value of the data source and added to the routing configuration information of the data source.
[0100] Optionally, based on the data source blacklist, multiple data sources are screened to obtain multiple data sources suitable for the first product.
[0101] As for the selection of blacklist and / or whitelist, as an example, the blacklist and whitelist of data sources can be determined based on information such as whether the use of the data source has expired and whether the price of use has changed. If the data source has not reached the contract signing period, it can be included in the whitelist, which means it can be used. Alternatively, if the contract is normal and it is planned to be used in subsequent plans, it will be planned to be included in the whitelist; alternatively, if the data source has passed the contract signing period (that is, if continuing to call it will be a breach of contract), the data source can be included in the blacklist and the call is prohibited. Alternatively, if the price of the use of the data source rises in the short term and does not meet expected costs and other factors, it can be included in the blacklist.
[0102] Based on the routing information of the data source of the original tree sample, a decision tree sample can be formed by adding attributes such as roulette weight and priority, so as to realize the optimal selection of the data source based on the decision tree sample.
[0103] After screening multiple data sources through the blacklist and / or whitelist, an initial priority of each data source is determined.
[0104] As an implementation manner, an implementation manner of determining an initial priority of each of the multiple data sources includes:
[0105] S201, for each data source among a plurality of data sources, calculating a roulette weight of each data source.
[0106] As an implementation method, the roulette weight of each data source is calculated based on the price and call latency of each data source.
[0107] As a specific implementation method, after obtaining multiple data sources corresponding to the child nodes of the single product, the wheel weight of each data source is calculated by the following formula:
[0108]
[0109] Among them, f represents the roulette weight of the data source, ω is the adaptability factor parameter, a is the price factor parameter, round(a) is the nearest integer factor of the price factor, the unit is angle; t is the time factor parameter, the unit is milliseconds.
[0110] Among them, the value of the time factor parameter t is calculated by the following formula:
[0111]
[0112] Where T is the call duration of each test, and n is the number of tests.
[0113] In the process of forming the decision tree, the roulette weight of the data source is obtained based on comprehensive factors such as the performance and price of the data source.
[0114] S202, based on the roulette weights of multiple data sources, obtain the roulette weight ratio of each data source.
[0115] Data sources with a combination of factors have a higher roulette weight ratio.
[0116] S203: Determine a roulette area for each data source based on the roulette weight ratio and a preset roulette mechanism.
[0117] S204, randomly generating a natural number based on a preset roulette mechanism, and determining a roulette area where the natural number is located in the preset roulette mechanism.
[0118] S205, determining an initial priority of each data source among the multiple data sources based on the roulette area where the natural number is located.
[0119] Example 1, this single product includes 3 child nodes, corresponding to data source 1 to data source 3. Data source 1 has a medium price, a price rounding factor of 1, good performance, low call delay, and the obtained time factor parameter is approximately 100 milliseconds. Data source 2 has an expensive price, a price rounding factor of 2, good performance, and a call delay of approximately 100 milliseconds. Data source 3 has a medium price, a price rounding factor of 1, slightly worse performance, and a longer call time, and the time factor parameter is approximately 200 milliseconds. For example, set the adaptability factor parameter ω to 1, calculate the roulette weight f of data sources 1 to 3, and obtain the roulette weight ratio of the three data sources as 2:1:1. If a roulette mechanism of 1 to 100 is set, and if the budget cost is reasonable, in order to improve the user experience and ensure that the remaining data sources can be reasonably called, data source 1 can be set to the roulette area of 1 to 50, and data source 2 and data source 3 can be set to the roulette area of 51 to 75 and the roulette area of 76 to 100 respectively according to the roulette weight ratio of 2:1:1.
[0120] A natural number is randomly generated in the roulette mechanism of 1 to 100. If it is determined that the natural number falls in the range of 1 to 50, the data source 1 corresponding to the range is the data source with the highest initial priority. If it is in the range of 51 to 75, the data source 2 corresponding to the range is the data source with the highest initial priority. If it is in the range of 76 to 100, the data source 3 corresponding to the range is the data source with the highest initial priority.
[0121] In step S105, based on the initial priority of each data source among the multiple data sources and the relevant calling information of each data source, the selection probability of each data source is obtained; and based on the selection probability of the multiple data sources, the target data source among the multiple data sources is determined and called.
[0122] As an implementation manner, based on the initial priority of each data source among the multiple data sources, the pheromone between each data source and the first product, and the call delay of each data source, the selection probability of each data source is obtained.
[0123] The selection probability of each data source is obtained, and the final priority of each data source can be determined based on the selection probability. For example, the final priority can be set from high to low according to the selection probability from large to small.
[0124] It should also be noted that after determining the roulette weight, initial priority, and selection probability or final priority of each data source, one or more of the roulette weight, initial priority, selection probability or final priority can be set based on the tree routing information of each data source. For example, the roulette weight, initial priority, selection probability or final priority can be added to the label number of the data source as attributes of each corresponding data source. It can be understood that in this way, the original tree sample becomes a decision tree, and when a data source is called, a suitable data source is selected based on the decision tree.
[0125] Optionally, determine the data source with the highest selection probability as the target data source to be called, that is, call the data source with the highest final priority.
[0126] In the prior art, the management method of multiple data sources is relatively chaotic, and it is impossible to comprehensively analyze the pros and cons of the data sources based on their pros and cons. The original tree sample of the embodiment of the present application forms a decision tree after adding attributes such as wheel weight and priority, which solves the pain point that multiple data sources cannot be managed uniformly, standardizes the management and selection mode of multiple data sources, and realizes innovative channel distribution of data sources.
[0127] As a specific implementation method, according to the initial priority of each data source, the pheromone between each data source and the user's requested product m, and the call delay of each data source, the selection probability of each data source is calculated by the following calculation formula, and the data source suitable for the user's requested product m is selected from several data sources according to the selection probability:
[0128]
[0129] Where P(i) represents the selection probability of data source i; τ(i,m) represents the pheromone between data source i and user requested product m (first product); δ and θ represent the influence of preset heuristic function and pheromone respectively; τ(t i ,m) represents the pheromone between the call delay of data source i and the user request product m; η(i) represents the source scheduling heuristic function of data i; η(t i ) represents the scheduling heuristic function of the call delay of data source i. ψ represents the priority weight value corresponding to the initial priority of the data source;
[0130] in,
[0131]
[0132]
[0133]
[0134]
[0135] Among them, U(i) represents the upward ranking of the initial priority of data source i. The higher the initial priority of the data source, the smaller the value corresponding to the upward ranking of the initial priority of the data source. Indicates the average roulette area value of the roulette areas corresponding to all data sources; It represents the average roulette area value of the roulette area corresponding to the data source j at the next priority level of data source i, excluding data source i. U(j) represents the upward ranking of the initial priority of data source j, where data source j refers to the data source at the next priority level of data source i (there may be multiple data sources at the next priority level of data source i).
[0136] As an implementation method, the abstract factory pattern can be used when calling the target data source: according to the tag number of the selected target data source, the data source information of the data source is sent to the abstract factory. The abstract factory generates a data source instance from top to bottom based on the received data source information, and calls the target data source through the data source instance to obtain the data call result, that is, whether the call is successful.
[0137] It should also be noted that if the call result is successful, the above-mentioned processing flow of the next associated single product is carried out. If the call fails, a new target data source is selected from the remaining data sources for calling.
[0138] The calling method of multiple data sources in the embodiment of the present application constructs an original tree sample based on a combination product, a single product, and a data source, forms a decision tree sample by adding attributes such as roulette weight and priority based on the routing information of the data source, and implements the preferential selection of the data source based on the decision tree sample. In the process of forming the decision tree, the roulette weight of the data source is obtained based on comprehensive factors such as the performance and price of the data source, and the initial priority of the data source is determined based on the roulette weight. Then, the final priority of the data source is obtained in combination with other call-related factors of the data source, and the preferential calling of multi-dimensional data sources is implemented based on the final priority. Based on the decision tree, multiple dimensions of the data source can be better integrated for analysis, so as to select a better data source for service calling, which saves costs and improves user experience to a certain extent.
[0139] The above embodiment corresponds to the case where the first product is a combination product. In the case where the first product is a single product, Figure 4 FIG. 1 is a flowchart of a method for calling multiple data sources according to another embodiment of the present application. Figure 4 As shown, the calling method of the multi-data source may include the following steps.
[0140] In step S301, in response to a product service request, request parameter information carried in the product service request is obtained; and a first product satisfying the product service request is determined based on the request parameter information.
[0141] In step S302, the routing information of the first product in the original tree sample is obtained, and based on the routing information, the product type of the first product is determined; wherein the product type includes a combination product and a single product; the original tree sample is constructed with services, products and data sources as root nodes, branch nodes and leaf nodes respectively; the child nodes of the combination product are combination products or single products, and the child nodes of the single product are data sources.
[0142] In step S303, when the product type of the first product is a single product, multiple data sources associated with the single product are obtained; and a roulette weight decision is performed on the multiple data sources to determine the initial priority of each of the multiple data sources.
[0143] In step S304, based on the initial priority of each data source among the multiple data sources and the relevant calling information of each data source, the selection probability of each data source is obtained; and based on the selection probability of the multiple data sources, the target data source among the multiple data sources is determined and called.
[0144] It should be noted that, in the embodiment of the present application, the implementation process of the above steps S301 to S304 can refer to the description of the implementation process of the above steps S101, S102, S104, and S105, which will not be repeated here.
[0145] It should also be noted that, during the process of calling the data source, the data source calling may fail. In this case, a new data source may be selected for calling. That is, after step S105, the following operations may be performed.
[0146] Figure 5 FIG. 1 is a flowchart of a method for calling multiple data sources according to another embodiment of the present application. Figure 5 As shown, the calling method of the multi-data source may include the following steps.
[0147] In step S401, it is determined whether the target data source is successfully called.
[0148] In step S402, when the target data source is not successfully called, the selection probability of each alternative data source other than the target data source among the multiple data sources is calculated.
[0149] As an implementation method, taking Example 1 in the above embodiment as an example, if the highest priority data source fails to be called, the roulette mechanism needs to be re-entered, and the roulette area corresponding to the failed data source is partially abandoned, and the remaining data sources are subject to priority election decisions. For example, if data source 1 fails to be called after being selected for the first time, the part of the roulette area 1 to 50 corresponding to the data source 1 is abandoned, and the election is re-performed in the roulette area 51 to 100, and then the initial priority of data sources 2 and 3 is re-determined, and the selection probability of data sources 2 and 3 is calculated.
[0150] In order to improve the success rate of calling the data source, as another implementation method, the selection probability of each data source other than the target data source among multiple data sources is calculated, including: based on a preset data source selection rule, calculating the selection probability of each data source other than the target data source among multiple data sources.
[0151] If the target data source selected in the above step is unsuccessful, the selection probability of each alternative data source is calculated according to the preset data source selection rule, and then the alternative data source, i.e., the new target data source, is selected according to the selection probability. The preset data source selection rule refers to the comprehensive selection of alternative data sources based on factors such as the call success rate of the data source, the call waiting time, and the call cost, so as to ensure that the call waiting time and call cost of the data source are minimized when the data source call is successful.
[0152] As a specific implementation method, the selection probability of each data source other than the target data source among multiple data sources may be calculated according to the following preset data source selection rule:
[0153]
[0154]
[0155] Among them, p(h) represents the probability of selecting an alternative data source other than the data source that failed in the first call, τ(h cost ,m) represents the pheromone between the alternative data source h and the user requested product m; λ(h cost ) represents the cost-effectiveness competitive factor of alternative data source h; τ(α h ,m) represents the pheromone between the call success rate of the alternative data source h and the user's request for product m; EST(h,T) represents the call waiting time required to wait when calling the alternative data source h.
[0156] In step S403, based on the selection probability of each alternative data source, a new target data source is determined and called.
[0157] For example, a data source with the highest selection probability among the alternative data sources may be selected as the new target data source.
[0158] The calling method of multiple data sources of the embodiment of the present application, based on any of the above embodiments, provides a method for selecting an alternative data source when the data source call fails, which can minimize the calling waiting time and calling cost of the data source while ensuring the success of the data source call.
[0159] Corresponding to the above method embodiment, Figure 6 1 is a block diagram of a device for calling multiple data sources according to an exemplary embodiment. Figure 6 The calling device of the multiple data sources may include: a data parsing module 601, a product type determination module 602, a process control module 603, a roulette decision module 604 and a target determination module 605.
[0160] Specifically, the data parsing module 601 is used to obtain request parameter information carried in the product service request in response to the product service request; and determine the first product that meets the product service request based on the request parameter information;
[0161] The product type determination module 602 is used to obtain the routing information of the first product in the original tree sample, and determine the product type of the first product based on the routing information; wherein the product type includes a combination product and a single product; the original tree sample is constructed with services, products and data sources as root nodes, branch nodes and leaf nodes respectively; the child nodes of the combination product are combination products or single products, and the child nodes of the single product are data sources;
[0162] The process control module 603 is used to address the single products associated with the first product in the original tree sample one by one when the product type of the first product is a component product, and perform the following steps on the single product until the product service request response is completed;
[0163] A roulette decision module 604 is used to obtain multiple data sources associated with the single product, and perform a roulette weight decision on the multiple data sources to determine the initial priority of each of the multiple data sources;
[0164] The target determination module 605 is used to obtain the selection probability of each data source based on the initial priority of each data source and the relevant calling information of each data source; and determine and call the target data source among the multiple data sources based on the selection probability of the multiple data sources.
[0165] In some implementations, the roulette decision module 604 is further configured to:
[0166] In the case where the product type of the first product is a single product, multiple data sources associated with the single product are obtained; and a roulette weight decision is performed on the multiple data sources to determine an initial priority of each of the multiple data sources;
[0167] The target determination module 605 is used to obtain the selection probability of each data source based on the initial priority of each data source and the relevant calling information of each data source; and determine and call the target data source among the multiple data sources based on the selection probability of the multiple data sources.
[0168] In some implementations, the roulette decision module 604 is specifically configured to:
[0169] For each data source among the plurality of data sources, calculating a roulette weight of each data source;
[0170] Based on the roulette weights of multiple data sources, obtain the roulette weight ratio of each data source;
[0171] Based on the roulette weight ratio and the preset roulette mechanism, determine the roulette area for each data source;
[0172] Randomly generate a natural number based on a preset roulette mechanism, and determine the roulette area where the natural number is located in the preset roulette mechanism;
[0173] Based on the roulette wheel region where the natural number is located, an initial priority of each of the multiple data sources is determined.
[0174] In some implementations, the roulette decision module 604, when calculating the roulette weight of each data source, is used to:
[0175] The roulette weight of each data source is calculated based on the price and call latency of each data source.
[0176] In some implementations, the apparatus further includes:
[0177] Result judgment module 606, used to judge whether the target data source is successfully called;
[0178] The alternative calculation module 607 is used to calculate the selection probability of each alternative data source other than the target data source among multiple data sources when the target data source is not successfully called; and determine and call a new target data source based on the selection probability of each alternative data source.
[0179] In some implementations, when calculating the selection probability of each data source other than the target data source among the multiple data sources, the alternative calculation module 607 is specifically configured to:
[0180] Based on the preset data source selection rule, the selection probability of each data source among the multiple data sources except the target data source is calculated.
[0181] In some implementations, when obtaining the selection probability of each data source based on the initial priority of each data source among the multiple data sources and the related call information of each data source, the target determination module 605 is used to:
[0182] Based on the initial priority of each data source among the multiple data sources, the pheromone between each data source and the first product, and the calling delay of each data source, the selection probability of each data source is obtained.
[0183] In some implementations, after obtaining multiple data sources associated with the single product, the roulette decision module 604 is further configured to:
[0184] Based on the data source blacklist, multiple data sources are screened to obtain multiple data sources suitable for the first product.
[0185] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0186] The calling device of multiple data sources in the embodiment of the present application constructs an original tree sample based on a combination product, a single product, and a data source, forms a decision tree sample by adding attributes such as a roulette weight and a priority based on the routing information of the data source, and implements the preferential selection of the data source based on the decision tree sample. In the process of forming the decision tree, the roulette weight of the data source is obtained based on comprehensive factors such as the performance and price of the data source, and the initial priority of the data source is determined based on the roulette weight. Then, the final priority of the data source is obtained in combination with other call-related factors of the data source, and the preferential call of the multi-dimensional data source is implemented based on the final priority. Based on the decision tree, the multiple dimensions of the data source can be better integrated for analysis, so as to select a better data source for service call, which saves costs and improves user experience to a certain extent. When the data source call fails, a method for selecting an alternative data source is provided, which can minimize the call waiting time and call cost of the data source while ensuring that the data source call is successful.
[0187] According to an embodiment of the present application, the present application also provides an electronic device and a readable storage medium.
[0188] like Figure 7, is a block diagram of an electronic device for implementing a method for calling multiple data sources according to an embodiment of the present application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0189] like Figure 7 As shown, the electronic device includes: one or more processors 701, a memory 702, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In other embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 7 A processor 701 is taken as an example.
[0190] The memory 702 is a non-transitory computer-readable storage medium provided in the present application. The memory stores instructions executable by at least one processor to enable the at least one processor to perform the method for calling multiple data sources provided in the present application. The non-transitory computer-readable storage medium of the present application stores computer instructions, which are used to enable a computer to perform the method for calling multiple data sources provided in the present application.
[0191] The memory 702 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the method for calling multiple data sources in the embodiment of the present application (for example, the attached Figure 6 The processor 701 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 702, that is, the method of calling multiple data sources in the above method embodiment is implemented.
[0192] The memory 702 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required by at least one function; the data storage area may store data created by the use of the electronic device called by multiple data sources, etc. In addition, the memory 702 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 702 may optionally include a memory remotely arranged relative to the processor 701, and these remote memories may be connected to the electronic device called by multiple data sources via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0193] The electronic device of the method for calling multiple data sources may further include: an input device 703 and an output device 704. The processor 701, the memory 702, the input device 703 and the output device 704 may be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.
[0194] The input device 703 can receive input digital or character information, and generate key signal input related to user settings and function control of the electronic device called by the multiple data sources, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick and other input devices. The output device 704 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.
[0195] Various implementations of the systems and techniques described herein can be realized in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0196] These computer programs (also referred to as programs, software, software applications, or code) include machine instructions for programmable processors and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or means (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0197] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0198] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by 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), and the Internet.
[0199] A computer system may include clients and servers. Clients and servers are generally remote from each other and typically interact through a communication network. The relationship of client and server arises through computer programs running on the respective computers and having a client-server relationship to each other.
[0200] In an exemplary embodiment, a computer program product is also provided. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to perform the above method.
[0201] It should also be noted that the exemplary embodiments mentioned in the present invention describe some methods or systems based on a series of steps or devices. However, the present invention is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiments, or in a different order from the embodiments, or several steps can be performed simultaneously.
[0202] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only.
[0203] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A method for calling multiple data sources, characterized in that: include: In response to the product service request, obtaining request parameter information carried in the product service request; and determining a first product that satisfies the product service request based on the request parameter information; Obtaining routing information of the first product in the original tree sample, and determining the product type of the first product based on the routing information; wherein the product type includes a combination product and a single product; the original tree sample is constructed with services, products and data sources as root nodes, branch nodes and leaf nodes respectively; the child nodes of the combination product are combination products or single products, and the child nodes of the single product are data sources; In the case that the product type of the first product is a combination product, addressing the single products associated with the first product in the original tree sample one by one, and performing the following steps on the single products until the product service request response ends; Acquire multiple data sources associated with the single product, and perform a roulette weight decision on the multiple data sources to determine an initial priority of each of the multiple data sources; Based on the initial priority of each data source among the multiple data sources and the relevant calling information of each data source, the selection probability of each data source is obtained; and based on the selection probability of the multiple data sources, the target data source among the multiple data sources is determined and called.
2. The method according to claim 1, characterized in that The method further comprises: In the case where the product type of the first product is a single product, multiple data sources associated with the single product are obtained; and a roulette weight decision is performed on the multiple data sources to determine an initial priority of each of the multiple data sources; Based on the initial priority of each data source among the multiple data sources and the relevant calling information of each data source, the selection probability of each data source is obtained; and based on the selection probability of the multiple data sources, the target data source among the multiple data sources is determined and called.
3. The method according to claim 1 or 2, characterized in that: The performing a roulette wheel weight decision on the multiple data sources to determine the initial priority of each of the multiple data sources includes: For each data source among the plurality of data sources, calculating a roulette weight of each data source; Based on the roulette weights of the multiple data sources, obtaining the roulette weight ratio of each data source; Determine the roulette area of each data source based on the roulette weight ratio and the preset roulette mechanism; Randomly generate a natural number based on the preset roulette mechanism, and determine the roulette area where the natural number is located in the preset roulette mechanism; Based on the roulette area where the natural number is located, an initial priority of each data source among the multiple data sources is determined.
4. The method according to claim 3, characterized in that The calculating the roulette weight of each data source includes: Based on the price and call latency of each data source, a roulette weight of each data source is calculated.
5. The method according to claim 1 or 2, characterized in that: After determining and calling the target data source among the multiple data sources, the method further includes: Determine whether the target data source is successfully called; In the case that the target data source is not successfully called, calculating the selection probability of each alternative data source among the multiple data sources except the target data source; Based on the selection probabilities of the alternative data sources, a new target data source is determined and called.
6. The method according to claim 5, characterized in that The calculating the selection probability of each data source other than the target data source among the multiple data sources includes: Based on the preset data source selection rule, the selection probability of each data source among the multiple data sources except the target data source is calculated.
7. The method according to claim 1 or 2, characterized in that: The acquiring the selection probability of each data source based on the initial priority of each data source among the multiple data sources and the related call information of each data source includes: Based on the initial priority of each data source among the multiple data sources, the pheromone between each data source and the first product, and the call delay of each data source, the selection probability of each data source is obtained.
8. The method according to claim 1 or 2, characterized in that: After obtaining the multiple data sources associated with the single product, the method further includes: Based on the data source blacklist, the multiple data sources are screened to obtain multiple data sources suitable for the first product.
9. A device for calling multiple data sources, characterized in that: include: A data parsing module, used to respond to a product service request and obtain request parameter information carried in the product service request; and determining a first product that satisfies the product service request based on the request parameter information; a product type determination module, configured to obtain routing information of the first product in the original tree sample, and determine the product type of the first product based on the routing information; wherein the product types include combined products and single products; the original tree sample is constructed with services, products and data sources as root nodes, branch nodes and leaf nodes respectively; the child nodes of the combined product are combined products or single products, and the child nodes of the single product are data sources; a process control module, configured to, when the product type of the first product is a combination product, address the single products associated with the first product in the original tree sample one by one, and perform the following steps on the single products until the product service request response is completed; A roulette decision module, used to obtain multiple data sources associated with the single product, and perform a roulette weight decision on the multiple data sources to determine the initial priority of each data source in the multiple data sources; A target determination module is used to obtain the selection probability of each data source among the multiple data sources based on the initial priority of each data source and the relevant calling information of each data source; and determine and call the target data source among the multiple data sources based on the selection probability of the multiple data sources.
10. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the calling method of multiple data sources according to any one of claims 1 to 8.
11. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to enable the computer to execute the method for calling multiple data sources according to any one of claims 1 to 8.
