WO2021217307A1 - 分流方法、装置、服务器以及存储介质 - Google Patents

分流方法、装置、服务器以及存储介质 Download PDF

Info

Publication number
WO2021217307A1
WO2021217307A1 PCT/CN2020/087065 CN2020087065W WO2021217307A1 WO 2021217307 A1 WO2021217307 A1 WO 2021217307A1 CN 2020087065 W CN2020087065 W CN 2020087065W WO 2021217307 A1 WO2021217307 A1 WO 2021217307A1
Authority
WO
WIPO (PCT)
Prior art keywords
experimental
version
experimental version
diversion
target
Prior art date
Application number
PCT/CN2020/087065
Other languages
English (en)
French (fr)
Inventor
郭子亮
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to PCT/CN2020/087065 priority Critical patent/WO2021217307A1/zh
Priority to CN202080094720.2A priority patent/CN115023689A/zh
Publication of WO2021217307A1 publication Critical patent/WO2021217307A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software

Definitions

  • This application relates to the field of offloading technology, and more specifically, to a offloading method, device, server, and storage medium.
  • this application proposes a distribution method, device, server and storage medium to solve the above-mentioned problems.
  • an embodiment of the present application provides a shunt method, the method includes: obtaining current shunt information, where the current shunt information includes a preset shunt ratio corresponding to each of the multiple experimental versions and The number of diversions corresponding to each experimental version; the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version are calculated to obtain the diversion corresponding to each experimental version Priority coefficient; based on the diversion priority coefficient corresponding to each experimental version, determine a target experimental version from the multiple experimental versions; drain to the target experimental version.
  • an embodiment of the present application provides a shunt device, the device includes: a current shunt information acquisition module, configured to obtain current shunt information, wherein the current shunt information includes each experiment in a plurality of experimental versions The preset diversion ratio corresponding to the version and the number of diversions corresponding to each experimental version; the diversion priority coefficient obtaining module is used to determine the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version. The number of diversions is calculated to obtain the diversion priority coefficient corresponding to each experimental version; the target experimental version determination module is used to determine the target from the multiple experimental versions based on the diversion priority coefficient corresponding to each experimental version Experimental version; Drainage module, used to drain to the target experimental version.
  • an embodiment of the present application provides a server, including a memory and a processor, the memory is coupled to the processor, the memory stores instructions, and when the instructions are executed by the processor, the The processor executes the above method.
  • an embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores program code, and the program code can be invoked by a processor to execute the above method.
  • the shunt method, device, server, and storage medium provided in the embodiments of this application obtain current shunt information, where the current shunt information includes the preset shunt ratio corresponding to each experimental version of the multiple experimental versions and the corresponding value for each experimental version.
  • the number of diversions, the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version are calculated, and the diversion priority coefficient corresponding to each experimental version is obtained, based on the diversion priority coefficient corresponding to each experimental version, Determine the target experimental version from multiple experimental versions, and drain to the target experimental version.
  • the diversion priority coefficient corresponding to each experimental version is obtained, and the diversion priority is based on the diversion priority.
  • the coefficient determines the target experimental version for drainage, so that the flow can be indiscriminately close to the preset diversion ratio, and is allocated to each experimental version.
  • Fig. 1 shows a schematic flow chart of the offloading method provided by an embodiment of the present application
  • FIG. 2 shows a schematic flow chart of the offloading method provided by another embodiment of the present application
  • FIG. 3 shows a schematic flow chart of the offloading method provided by still another embodiment of the present application.
  • FIG. 4 shows a schematic flowchart of step S304 of the offloading method shown in FIG. 3 of the present application
  • FIG. 5 shows a schematic flow chart of a shunt method provided by another embodiment of the present application.
  • FIG. 6 shows a schematic flow chart of the offloading method provided by still another embodiment of the present application.
  • FIG. 7 shows a schematic flowchart of step S504 of the offloading method shown in FIG. 6 of the present application.
  • FIG. 8 shows a schematic flowchart of a traffic distribution method provided by yet another embodiment of the present application.
  • Fig. 9 shows a block diagram of a shunt device provided by an embodiment of the present application.
  • FIG. 10 shows a block diagram of a server used to execute the offloading method according to the embodiment of the present application
  • FIG. 11 shows a storage unit used to store or carry program code for implementing the offloading method according to the embodiment of the present application according to an embodiment of the present application.
  • AB Test is one of the most common tools for variable control and optimization direction selection. Among them, AB Test can be understood as we are often faced with multiple design schemes or algorithm choices, such as an application or an interface of an electronic device. Whether a button is red or blue, which one is better for recommendation algorithm A or recommendation algorithm B, that is to say, the so-called A/B test is to formulate multiple plans for the same goal.
  • Hash generally transliterated as hash, is to transform an input of any length (also called pre-image pre-image) into a fixed-length output through a hash algorithm.
  • the output is the hash value.
  • This conversion is a kind of compression Mapping, that is, the space of the hash value is usually much smaller than the space of the input.
  • Different inputs may be hashed into the same output, so it is impossible to determine the unique input value from the hash value.
  • it is a kind of A function that compresses messages of any length into a message digest of a fixed length. For example: For each user who visits the ABtest experiment page, calculate the Hash value of the access ID information, and get the remainder of the modulo 100, which is 0-99. Assume that the traffic of the four versions of ABCD is 10:70:10:10 , Then the remainder 0-9 is the A version, 10-79 is the B version, 80-89 is the C version, and 90-99 is the D version.
  • User access IDs may have certain similarities, such as accounts automatically generated by the system, and users of the same batch or region may have similar accounts.
  • the Hash value generated by the Hash algorithm must be as random and uniformly distributed as possible. If random and uniform distribution cannot be guaranteed, users in the same batch or in the same region may be assigned to the same version, resulting in uneven distribution.
  • the choice of Hash algorithm also affects the actual shunt ratio. Only when the hash value is sufficient to achieve a sufficiently random and uniform distribution, the actual shunt ratio will tend to the preset ratio.
  • the current shunting technical solution not only relies on the choice of the hash algorithm, but also depends on the size of the shunt sample size. Only when the diversion sample size reaches a certain scale, can the actual diversion result approach the preset diversion ratio.
  • the inventor has discovered through long-term research and proposed the diversion method, device, server, and storage medium provided by the embodiments of this application.
  • the results are obtained
  • the diversion priority coefficient corresponding to each experimental version, and the target experimental version is determined according to the diversion priority coefficient for drainage, so that the flow can be indiscriminately close to the preset diversion ratio, and is allocated to each experimental version.
  • the specific shunting method will be described in detail in the subsequent embodiments.
  • FIG. 1 shows a schematic flow chart of a shunt method provided by an embodiment of the present application.
  • the diversion method is used to obtain the diversion priority coefficient corresponding to each experimental version by calculating the preset diversion ratio and the number of diversions corresponding to each experimental version, and determine the target experimental version for drainage according to the diversion priority coefficient, so that the flow can be The difference is close to the preset shunt ratio and is assigned to each experimental version.
  • the shunt method is applied to the shunt device 200 as shown in FIG. 9 and the server 100 configured with the shunt device 200 (FIG. 10 ).
  • the following will take a server as an example to illustrate the specific process of this embodiment. Of course, it is understandable that the server applied in this embodiment may be a cloud server or a traditional server, which is not limited here.
  • the flow shown in Fig. 1 will be described in detail below, and the shunting method may specifically include the following steps:
  • Step S101 Obtain current diversion information, where the current diversion information includes a preset diversion ratio corresponding to each experimental version of a plurality of experimental versions and the number of diversions corresponding to each experimental version.
  • multiple experimental versions can be set in advance, and multiple experimental versions can be tested. For example, if the number of multiple experimental versions is three, and the three experimental versions are the first experimental version, the second experimental version, and the third experimental version as an example, the first experimental version, the second experimental version, and the The third experimental version is tested.
  • the first experimental version is generated based on the first design plan
  • the second experimental version is generated based on the second design plan
  • the third experimental version is generated based on the third design plan
  • Version and the third experimental version are tested to select an experimental version that is more in line with the test goal based on the test results, and use the design plan corresponding to the experimental version that is more in line with the test goal to design subsequent experimental versions, for example, if the first experiment If the version is an experimental version that is more in line with the test objective, the first design scheme can be used to design subsequent experimental versions.
  • the first experimental version is generated based on the first algorithm
  • the second experimental version is generated based on the second algorithm
  • the third experimental version is generated based on the third algorithm
  • the third experimental version is tested to select an experimental version that is more in line with the test target based on the test results, and use the design plan corresponding to the experimental version that is more in line with the test target to design the subsequent experimental version, for example, if the first experimental version is For an experimental version that is more in line with the test objective, the first algorithm can be used to generate subsequent experimental versions.
  • the shunt ratio corresponding to each experimental version of the multiple experimental versions can be set as the preset shunt ratio, where the shunt ratio corresponding to each experimental version set can be The same or different.
  • the split ratios corresponding to the first experimental version, the second experimental version, and the third experimental version can be the same, all being 1/ 3.
  • the split ratios corresponding to the first experimental version and the second experimental version may be different, such as those corresponding to the first experimental version
  • the split ratio is 0.2
  • the split ratio corresponding to the second experimental version is 0.7
  • the split ratio corresponding to the third experimental version is 0.1, which is not limited here.
  • current diversion information can be obtained, where the current diversion information may include a preset diversion ratio corresponding to each experimental version of the multiple experimental versions and the number of diversions corresponding to each experimental version.
  • the preset shunt ratio corresponding to each experimental version can be directly obtained.
  • each experimental version before the test of the experimental version, each experimental version has not been diverted. Therefore, before the test of the experimental version, the number of diverted times corresponding to each experimental version is zero. In the process of version testing, each experimental version may have been diverted, or part of the experimental version may have been diverted, and the rest of the experimental versions may not have been diverted. Therefore, in the process of running the experimental version, you can record each The number of diversions of the experimental version is saved, and the number of diversions of each experimental version can be obtained based on the recorded and saved number of diversions of each experimental version.
  • the current distribution information may be stored in Redis centrally to ensure its use in a distributed deployment environment.
  • Redis full name: Remote Dictionary Server, remote dictionary service
  • Redis is an open source log-based, Key-Value database written in ANSI C language, supporting the network, memory-based or persistent, and providing APIs in multiple languages .
  • Step S102 Calculate the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version to obtain the diversion priority coefficient corresponding to each experimental version.
  • the preset diversion ratio corresponding to each experimental version and each The number of diversions corresponding to the experimental version is calculated to obtain the diversion priority coefficient corresponding to each experimental version.
  • the preset shunt ratio corresponding to each experimental version and the number of shunts corresponding to each experimental version in the current shunt information may be determined based on the preset formula. The ratio and the number of diversions corresponding to each experimental version are calculated to obtain the diversion priority coefficient corresponding to each experimental version.
  • the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version it can be based on Calculate the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version to obtain the diversion priority coefficient c i corresponding to each experimental version, where k represents the number of experimental versions, and r i represents the first The preset diversion ratio corresponding to i experimental versions, n i represents the number of diversions corresponding to the i-th experimental version.
  • the diversion priority coefficient can be used to reflect the difference between the preset diversion ratio and the actual diversion ratio. Therefore, the larger the diversion priority coefficient corresponding to the experimental version, the fewer times the experimental version has been diverted, and the default diversion ratio has not been reached. Therefore, each diversion can give priority to the experimental version with the largest priority coefficient. , When the actual number of diversions corresponding to the experimental version gradually increases, the classification priority coefficient corresponding to the experimental version will be reduced accordingly, so that the probability of being diverted is reduced, so as to achieve the effect of dynamic balance, so that each diversion is approaching In the preset shunt ratio.
  • the corresponding diversion priority coefficient can be set to -1 to ensure that it will not be diverted.
  • Step S103 Determine a target experimental version from the multiple experimental versions based on the diversion priority coefficient corresponding to each experimental version.
  • the target experimental version can be determined from the target experimental versions determined from the multiple experimental versions based on the diversion priority coefficient corresponding to each experimental version, where:
  • the determined target experimental version is the experimental version that has been diverted fewer times and failed to reach the preset diverted ratio.
  • the largest diversion priority coefficient in the diversion priority coefficients can be obtained, and the experimental version corresponding to the largest diversion priority coefficient in the diversion priority coefficients can be obtained, and the diversion priority will be given priority.
  • the experimental version corresponding to the largest diversion priority coefficient among the coefficients is determined as the target experimental version.
  • the multiple experimental versions can be sorted based on the diversion priority coefficient corresponding to each experimental version in descending order, and the experiment that is ranked first is sorted. The version is determined as the target experimental version.
  • Step S104 Drain traffic to the target experimental version.
  • the target experimental version after the target experimental version is determined from multiple experimental versions, the target experimental version can be drained to increase the number of diversions of the target experimental version, so that the actual diversion ratio of the target experimental version approaches the preset diversion ratio , In order to reach the test goal.
  • driving traffic to the target experimental version may push the target experimental version to the user, and may also include processing the access request through the target experimental version when an access request is received, which is not limited herein.
  • the incr command in Redis can be used to divert traffic to the target experimental version, that is, the incr command in Redis can be used to auto-increase the number of diverting times of the target experimental version.
  • the shunt method obtaineds current shunt information, where the current shunt information includes the preset shunt ratio corresponding to each experimental version of the multiple experimental versions and the number of shunts corresponding to each experimental version.
  • the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version are calculated, and the diversion priority coefficient corresponding to each experimental version is obtained.
  • Based on the diversion priority coefficient corresponding to each experimental version from multiple experimental versions Determine the target experimental version and drain to the target experimental version.
  • the diversion priority coefficient corresponding to each experimental version is obtained, and the target experimental version is determined according to the diversion priority coefficient. Drainage, so that the flow can be indiscriminately close to the preset diversion ratio, and is allocated to each experimental version.
  • FIG. 2 shows a schematic flowchart of a shunt method provided by another embodiment of the present application.
  • the method shown in FIG. 2 will be described in detail below, and the shunting method may specifically include the following steps:
  • Step S201 Acquire current diversion information, where the current diversion information includes a preset diversion ratio corresponding to each experimental version of a plurality of experimental versions and the number of diversions corresponding to each experimental version.
  • Step S202 Calculate the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version to obtain the diversion priority coefficient corresponding to each experimental version.
  • step S201 to step S202 please refer to step S101 to step S102, which will not be repeated here.
  • Step S203 Based on the diversion priority coefficient corresponding to each experimental version, obtain the difference between the preset diversion ratio corresponding to each experimental version and the current diversion ratio.
  • the difference between the preset diversion ratio corresponding to each experimental version and the current diversion ratio can be obtained based on the diversion priority coefficient corresponding to each experimental version. value.
  • the diversion priority coefficient corresponding to each experimental version can be passed It is calculated, therefore, when r i > 0, the diversion priority coefficient is: in, Represents the preset shunt ratio corresponding to the i-th experimental version, Is the current shunt ratio corresponding to the i-th experimental version, so that the difference between the preset shunt ratio and the current shunt ratio corresponding to each experimental version can be obtained.
  • Step S204 Determine a target experimental version from the multiple experimental versions based on the difference between the preset shunt ratio corresponding to each experimental version and the current shunt ratio.
  • the difference between the preset shunt ratio corresponding to the experimental version and the current shunt ratio when the difference between the preset shunt ratio corresponding to the experimental version and the current shunt ratio is larger, it means that the experimental version has been diverted fewer times and failed to reach the preset shunt ratio.
  • the experimental version corresponds to the preset shunt ratio
  • the preset shunt ratio and the current shunt ratio corresponding to each experimental version may be based on the difference between the preset shunt ratio and the current shunt ratio corresponding to each experimental version. , To determine the target experimental version from multiple experimental versions.
  • Versions can include: obtain the difference between the preset shunt ratio and the current shunt ratio corresponding to each experimental version from multiple experimental versions, and set the experimental version with the largest difference between the preset shunt ratio and the current shunt ratio Determined as the target experimental version.
  • Step S205 Drain traffic to the target experimental version.
  • step S205 For the specific description of step S205, please refer to step S104, which will not be repeated here.
  • the shunt method provided by another embodiment of the present application obtains current shunt information, where the current shunt information includes the preset shunt ratio corresponding to each experimental version of the multiple experimental versions and the number of shunts corresponding to each experimental version.
  • the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version are calculated to obtain the diversion priority coefficient corresponding to each experimental version, and each experimental version is obtained based on the diversion priority coefficient corresponding to each experimental version
  • the difference between the corresponding preset shunt ratio and the current shunt ratio determine the target experimental version from the multiple experimental versions, and then Experimental version drainage.
  • this embodiment Compared with the diversion method shown in Fig. 1, this embodiment also obtains the difference between the preset diversion ratio corresponding to each experimental version and the current diversion ratio according to the diversion priority coefficient corresponding to each experimental version, and based on this The difference determines the target experimental version, thereby improving the accuracy of determining the target experimental version and the rationality of diversion, so as to better meet the diversion requirements of the setting.
  • FIG. 3 shows a schematic flowchart of a shunt method provided by another embodiment of the present application.
  • the following will elaborate on the process shown in FIG. 3, and the shunting method may specifically include the following steps:
  • Step S301 Obtain current diversion information, where the current diversion information includes a preset diversion ratio corresponding to each experimental version of a plurality of experimental versions and the number of diversions corresponding to each experimental version.
  • Step S302 Calculate the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version to obtain the diversion priority coefficient corresponding to each experimental version.
  • step S301 to step S302 please refer to step S101 to step S102, which will not be repeated here.
  • Step S303 Sort the multiple experimental versions based on the shunt priority coefficient corresponding to each experimental version.
  • multiple experimental versions can be sorted based on the diversion priority coefficient corresponding to each experimental version.
  • the multiple experimental versions can be sorted in descending order of diversion priority coefficient based on the diversion priority coefficient corresponding to each experimental version. For example, suppose the experimental version includes the first experimental version, the second experimental version, and the third experimental version, and the first experimental version corresponds to the first diversion priority coefficient, the second experimental version corresponds to the second diversion priority coefficient, and the third experimental version corresponds to the third experimental version.
  • Step S304 Based on the sorting order of the multiple experimental versions, a target experimental version is determined from the multiple experimental versions.
  • the sorting order of the multiple experimental versions can be obtained, and then the target experimental version can be determined from the multiple experimental versions based on the sorting order of the multiple experimental versions.
  • the sorting order of multiple experimental versions is based on the corresponding diversion priority coefficient from large to small, then the first experimental version can be determined from the multiple experimental versions as the target experimental version.
  • the sorting order of is in the descending order of the corresponding shunt priority coefficient, the lower-ranked experimental version can be determined from multiple experimental versions as the target experimental version.
  • FIG. 4 shows a schematic flowchart of step S304 of the shunt method shown in FIG. 3 of the present application.
  • the following will elaborate on the process shown in FIG. 4, and the method may specifically include the following steps:
  • Step S3041 Based on the sorting sequence of the multiple experimental versions, obtain the experimental version with the first sorting sequence.
  • the multiple experimental versions are sorted in descending order of the diversion priority coefficient. Therefore, the higher the sorting order of the experimental version is, the higher the diversion priority coefficient corresponding to the experimental version is, the less the experimental version is diverted to and the preset diversion ratio is not reached, and the lower the sorting order of the experimental version is , Which means that the smaller the diversion priority coefficient corresponding to the experimental version, the more times the experimental version is diverted, and it is basically close to the preset diversion ratio. Therefore, the experimental version with the first sorting order corresponds to the largest diversion priority coefficient, the least number of diversions, and the largest gap with the preset diversion ratio. Therefore, the experimental version with the first sorting order can be obtained and the sorting is the first The experimental version of is determined to be the target experimental version.
  • Step S3042 Determine the experimental version with the first in the sorting order as the target experimental version.
  • Step S305 Drain traffic to the target experimental version.
  • step S305 For the specific description of step S305, please refer to step S104, which will not be repeated here.
  • the diversion method provided in another embodiment of the present application obtains current diversion information, where the current diversion information includes the preset diversion ratio corresponding to each experimental version of the multiple experimental versions and the number of diversions corresponding to each experimental version.
  • the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version are calculated, and the diversion priority coefficient corresponding to each experimental version is obtained.
  • multiple experimental versions Sort Based on the diversion priority coefficient corresponding to each experimental version, multiple experimental versions Sort, based on the sorting order of multiple experimental versions, determine the target experimental version from the multiple experimental versions, and drain to the target experimental version.
  • this embodiment Compared with the diversion method shown in Figure 1, this embodiment also sorts multiple experimental versions according to the diversion priority coefficient corresponding to each experimental version, and determines the target experimental version according to the sorting order, thereby improving the determination of the target experimental version Accuracy and rationality of diversion to better meet the diversion requirements of the setting.
  • FIG. 5 shows a schematic flowchart of a shunt method provided by another embodiment of the present application.
  • the flow shown in FIG. 5 will be described in detail below, and the shunting method may specifically include the following steps:
  • Step S401 Acquire current diversion information, where the current diversion information includes a preset diversion ratio corresponding to each experimental version of a plurality of experimental versions and the number of diversions corresponding to each experimental version.
  • Step S402 Calculate the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version to obtain the diversion priority coefficient corresponding to each experimental version.
  • step S401-step S402 please refer to step S101-step S102, which will not be repeated here.
  • Step S403 Based on the diversion priority coefficient corresponding to each experimental version, obtain the experimental version with the largest diversion priority coefficient from the multiple experimental versions.
  • the experimental version with the largest diversion priority coefficient can be obtained from the multiple experimental versions based on the diversion priority coefficient corresponding to each experimental version.
  • the diversion priority coefficient corresponding to each experimental version can be compared to obtain the largest diversion priority coefficient and obtain the maximum diversion priority coefficient.
  • the experimental version corresponding to the coefficient the experimental version has the largest diversion priority coefficient, which means that the experimental version has been diverted the least number of times, and the gap with the preset diversion ratio is the largest. Therefore, the experimental version with the largest diversion priority coefficient can be obtained from multiple experimental versions, and The experimental version with the largest diversion priority coefficient is determined as the target experimental version.
  • Step S404 Determine the experimental version with the largest diversion priority coefficient as the target experimental version.
  • Step S405 Drain the traffic to the target experimental version.
  • step S405 For the specific description of step S405, please refer to step S104, which will not be repeated here.
  • the shunt method provided by another embodiment of the present application obtains current shunt information, where the current shunt information includes the preset shunt ratio corresponding to each experimental version of the multiple experimental versions and the number of shunts corresponding to each experimental version.
  • the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version are calculated, and the diversion priority coefficient corresponding to each experimental version is obtained.
  • Based on the diversion priority coefficient corresponding to each experimental version from multiple experimental versions Obtain the experimental version with the largest diversion priority coefficient in, determine the experimental version with the largest diversion priority coefficient as the target experimental version, and drain to the target experimental version.
  • this embodiment Compared with the diversion method shown in Figure 1, this embodiment also determines the experimental version with the largest diversion priority coefficient from the multiple experimental versions as the target experimental version according to the diversion priority coefficient corresponding to each experimental version, thereby improving the target experiment
  • the accuracy of the version determination and the rationality of the diversion are in order to better meet the diversion requirements of the setting.
  • FIG. 6 shows a schematic flowchart of a shunting method provided by yet another embodiment of the present application.
  • the flow shown in FIG. 6 will be described in detail below, and the shunting method may specifically include the following steps:
  • Step S501 Obtain current diversion information, where the current diversion information includes a preset diversion ratio corresponding to each experimental version of a plurality of experimental versions and the number of diversions corresponding to each experimental version.
  • Step S502 Calculate the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version to obtain the diversion priority coefficient corresponding to each experimental version.
  • Step S503 Determine a target experimental version from the multiple experimental versions based on the diversion priority coefficient corresponding to each experimental version.
  • step S501-step S503 please refer to step S101-step S103, which will not be repeated here.
  • Step S504 When the number of times of diversion corresponding to each experimental version is zero, determine the target experimental version from the multiple experimental versions based on the preset diversion ratio corresponding to each experimental version.
  • the target experimental version can be determined from multiple experimental versions based on the preset shunt ratio corresponding to each experimental version.
  • the target experimental version can be determined from multiple experimental versions based on the size relationship of the preset diverging ratio corresponding to each experimental version.
  • FIG. 7 shows a schematic flowchart of step S504 of the shunt method shown in FIG. 6 of the present application.
  • the process shown in FIG. 7 will be described in detail below, and the method may specifically include the following steps:
  • Step S5041 When the number of splits corresponding to each experimental version is zero, obtain the experimental version with the largest preset split ratio from the multiple experimental versions.
  • the experimental version with the largest preset shunt ratio requires the most number of shunts, and the experimental version with the smallest preset shunt ratio requires the least number of shunts. Therefore, in this embodiment, when the number of splits corresponding to each experimental version is zero, the experimental version with the largest preset split ratio can be obtained from multiple experimental versions, and the experiment with the largest preset split ratio can be obtained The version is determined as the target experimental version, and the experimental version with the largest number of diversions required is first diverted.
  • Step S5042 Determine the experimental version with the largest preset shunt ratio as the target experimental version.
  • Step S505 Drain traffic to the target experimental version.
  • step S505 For the specific description of step S505, please refer to step S104, which will not be repeated here.
  • the diversion method provided in yet another embodiment of the present application obtains current diversion information, where the current diversion information includes the preset diversion ratio corresponding to each experimental version of the multiple experimental versions and the number of diversions corresponding to each experimental version, Calculate the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version, and obtain the diversion priority coefficient corresponding to each experimental version. Based on the diversion priority coefficient corresponding to each experimental version, from multiple experiments The target experimental version is determined in the version. When the number of diversions corresponding to each experimental version is zero, based on the preset diversion ratio corresponding to each experimental version, the target experimental version is determined from multiple experimental versions and drained to the target experimental version . Compared with the diversion method shown in Fig.
  • the target experimental version is determined by the preset diversion ratio corresponding to each experimental version, thereby improving the target experiment
  • the accuracy of the version determination and the rationality of the diversion are in order to better meet the diversion requirements of the setting.
  • FIG. 8 shows a schematic flow chart of a shunt method provided by yet another embodiment of the present application.
  • the flow shown in FIG. 8 will be described in detail below, and the shunting method may specifically include the following steps:
  • Step S601 Obtain current diversion information, where the current diversion information includes a preset diversion ratio corresponding to each experimental version of a plurality of experimental versions and the number of diversions corresponding to each experimental version.
  • Step S602 Calculate the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version to obtain the diversion priority coefficient corresponding to each experimental version.
  • Step S603 Determine a target experimental version from the multiple experimental versions based on the diversion priority coefficient corresponding to each experimental version.
  • Step S604 Drain traffic to the target experimental version.
  • step S601 to step S604 please refer to step S101 to step S104, which will not be repeated here.
  • Step S605 Obtain user identification information corresponding to the access traffic that is diverted to the target experimental version.
  • user identification information corresponding to the access traffic draining to the target experimental version can be obtained.
  • the access traffic that leads to the target experimental version can be triggered by the user, or generated by the server pushing to the user, which is not limited here.
  • the user identification information may be identification information used to uniquely identify the user, such as a device ID used by the user, an account ID of the user, and the like, which is not limited herein.
  • Step S606 Cache the user identification information in Redis.
  • the user identification information after obtaining the user identification information corresponding to the access traffic to the target experimental version, the user identification information can be cached in Redis to ensure that the user identification information can be used in a distributed deployment environment.
  • the user identification information and the target experimental version may be cached in Redis in the form of key-value pairs. For example, it can be cached in Redis in a manner of: user ID 1-target experimental version 1, user ID 2-target experimental version 2...
  • Step S607 Set the cache expiration time of the user identification information.
  • the cache expiration time of the user identification information can be set.
  • the duration of the cache expiration time can be one day, one week, one month, etc., which is not limited here.
  • Step S608 If the user identification information access request is received within the cache expiration time, delay the cache expiration time of the user identification information.
  • the cache expiration time of the user identification information can be delayed.
  • the original cache expiration time can be reset, or a certain period of time can be added to the original cache expiration time, which is not limited here.
  • Step S609 If the user identification information access request is not received within the cache expiration time, delete the user identification information from Redis.
  • the user identification information access request is not received within the cache expiration time, the user identification information can be deleted from Redis to release storage space.
  • Step S610 Obtain the current number of splits corresponding to each experimental version.
  • the current number of diversions for each experimental version can be obtained.
  • multiple experimental versions include the first experimental version, the second experimental version, and the third experimental version
  • the first experimental version is the target experimental version.
  • the number of diversions is 10, the number of diversions corresponding to the second experimental version is 20, and the number of diversions corresponding to the third experimental version is 30.
  • the first experimental version is drained once, the first experiment
  • the current number of diversions corresponding to the version is 11 times
  • the current number of diversions corresponding to the second experimental version is 20 times
  • the current number of diversions corresponding to the third experimental version is 30 times.
  • Step S611 Cache the current number of splits corresponding to each experimental version in Redis.
  • the current number of taps corresponding to each experimental version can be cached in Redis to ensure that the current number of taps for each experimental version can be Used in a distributed deployment environment.
  • the version identification information corresponding to each experimental version can also be obtained, and the version identification information corresponding to each experimental version and the current number of diversions corresponding to each experimental version can be divided into key-value pairs.
  • the way is cached in Redis. For example, it can be cached in Redis in a manner of: version identifier 1-number of diverted times 1, version identifier 2-number of diverted times 2...
  • Step S612 Update the current diversion information based on the current number of diversions of each experimental version.
  • the current diversion information can be updated. Specifically, after acquiring the current diversion number of each experimental version, each of the current diversion information can be updated. The number of diversions of the experimental version is updated to the current number of diversions, and the number of classifications of each experimental version is dynamically adjusted.
  • the shunt method provided in yet another embodiment of the present application obtains current shunt information, where the current shunt information includes a preset shunt ratio corresponding to each experimental version of the multiple experimental versions and the number of shunts corresponding to each experimental version, Calculate the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version, and obtain the diversion priority coefficient corresponding to each experimental version.
  • this embodiment also caches the user identification information corresponding to the access traffic that is diverted to the target experimental version and the current number of offloads corresponding to each experimental version in Redis to ensure its distribution Used in a deployment environment.
  • this embodiment updates the current diversion information to provide a reference for the next diversion, improve the rationality of diversion, and better meet the set diversion requirements.
  • FIG. 9 shows a block diagram of a shunt device 200 provided in an embodiment of the present application.
  • the diversion device 200 includes: a current diversion information acquisition module 210, a diversion priority coefficient acquisition module 220, a target experiment version determination module 230, and a drainage module 240, in which:
  • the current diversion information acquisition module 210 is configured to acquire current diversion information, where the current diversion information includes a preset diversion ratio corresponding to each experimental version of a plurality of experimental versions and the number of diversions corresponding to each experimental version .
  • the diversion priority coefficient obtaining module 220 is configured to calculate the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version to obtain the diversion priority coefficient corresponding to each experimental version.
  • the diversion priority coefficient obtaining module 220 includes: a diversion priority coefficient obtaining sub-module, wherein:
  • the sub-module for obtaining the shunt priority coefficient is used based on Calculate the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version to obtain the diversion priority coefficient c i corresponding to each experimental version, where k represents the experimental version’s Quantity, r i represents the preset diversion ratio corresponding to the i-th experimental version, and n i represents the number of diversions corresponding to the i-th experimental version.
  • the target experimental version determination module 230 is configured to determine the target experimental version from the multiple experimental versions based on the diversion priority coefficient corresponding to each experimental version.
  • the target experimental version determination module 230 includes: a difference acquisition sub-module and a first target experimental version determination sub-module, wherein:
  • the difference obtaining sub-module is configured to obtain the difference between the preset shunt ratio corresponding to each experimental version and the current shunt ratio based on the shunt priority coefficient corresponding to each experimental version.
  • the first target experimental version determining sub-module is used to determine the target experimental version from the multiple experimental versions based on the difference between the preset shunt ratio corresponding to each experimental version and the current shunt ratio.
  • target experimental version determining module 230 includes: a ranking sub-module and a second target experimental version determining sub-module, wherein:
  • the sorting sub-module is used to sort the multiple experimental versions based on the shunt priority coefficient corresponding to each experimental version.
  • the sorting sub-module includes: a sorting unit, wherein:
  • the sorting unit is configured to sort the multiple experimental versions in descending order of the diversion priority coefficients based on the diversion priority coefficient corresponding to each experimental version.
  • the second target experimental version determination sub-module is used to determine the target experimental version from the plurality of experimental versions based on the sorting order of the plurality of experimental versions.
  • the second target experimental version determining submodule includes: a first experimental version obtaining unit and a target experimental version determining unit, wherein:
  • the first experimental version obtaining unit is used to obtain the experimental version with the first sorting order based on the sorting order of the multiple experimental versions.
  • the target experimental version determining unit is configured to determine the first experimental version in the sorting order as the target experimental version.
  • the target experimental version determination module 230 includes: a sub-module for obtaining the maximum experimental version of the diversion priority coefficient and a third target experimental version determining sub-module, wherein:
  • the sub-module for obtaining the experimental version with the largest shunt priority coefficient is used to obtain the experimental version with the largest shunt priority coefficient from the multiple experimental versions based on the shunt priority coefficient corresponding to each experimental version.
  • the third target experimental version determination sub-module is used to determine the experimental version with the largest diversion priority coefficient as the target experimental version.
  • the drainage module 240 is used for drainage to the target experimental version.
  • the drainage module 240 includes: a drainage sub-module, wherein:
  • the drainage sub-module is used to drain traffic to the target experimental version through the incr command in Redis.
  • the shunt device 200 further includes: a target experimental version acquisition module, wherein:
  • the target experimental version acquisition module is used to determine the number of diversions from the multiple experimental versions based on the preset diversion ratio corresponding to each experimental version when the number of diversions corresponding to each experimental version is zero. Target experimental version.
  • the target experimental version acquisition module includes: a preset maximum experimental version acquisition submodule and a target experimental version acquisition submodule, wherein:
  • the experimental version obtaining sub-module of the preset maximum diversion ratio is used to obtain the experimental version with the maximum preset diversion ratio from the multiple experimental versions when the number of diversions corresponding to each experimental version is zero.
  • the target experimental version acquisition sub-module is used to determine the experimental version with the largest preset shunt ratio as the target experimental version.
  • the shunt device 200 further includes: a user identification information acquisition module and a user identification information caching module, wherein:
  • the user identification information acquisition module is used to acquire user identification information corresponding to the access traffic that is diverted to the target experimental version.
  • the user identification information cache module is used to cache the user identification information in Redis.
  • the user identification information caching module includes: a user identification information caching sub-module, wherein:
  • the user identification information cache sub-module is used to cache the user identification information and the target experimental version in Redis in the form of key-value pairs.
  • the shunt device 200 further includes: a cache expiration time setting module, wherein:
  • the cache expiration time setting module is used to set the cache expiration time of the user identification information.
  • the shunt device 200 further includes: a buffer expiration time delay module and a user identification information deletion module, wherein:
  • the cache expiration time delay module is configured to delay the cache expiration time of the user identification information if the access request for the user identification information is received within the cache expiration time.
  • the user identification information deletion module is configured to delete the user identification information from Redis if the user identification information access request is not received within the cache expiration time.
  • the shunt device 200 further includes: a current shunt number acquisition module and a current shunt number buffer module, wherein:
  • the current diverted number acquisition module is used to acquire the current diverted number corresponding to each experimental version.
  • the current diverted times cache module is used to cache the current diverted times corresponding to each experimental version in Redis.
  • the current number of taps cache module includes: a version identification information acquisition submodule and a current taps cache submodule, wherein:
  • the version identification information acquisition sub-module is used to acquire the version identification information corresponding to each experimental version.
  • the current split times cache submodule is used to cache the version identification information corresponding to each experimental version and the current split times corresponding to each experimental version in Redis in the form of key-value pairs.
  • the shunt device 200 further includes: a current shunt information update module, wherein:
  • the current diversion information update module is used to update the current diversion information based on the current number of diversions of each experimental version.
  • the coupling between the modules may be electrical, mechanical or other forms of coupling.
  • the functional modules in the various embodiments of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or software functional modules.
  • FIG. 10 shows a structural block diagram of a server 100 provided by an embodiment of the present application.
  • the server 100 may be a server capable of running application programs, such as a smart phone, a tablet computer, or an e-book.
  • the server 100 in this application may include one or more of the following components: a processor 110, a memory 120, and one or more application programs, where one or more application programs may be stored in the memory 120 and configured to be operated by one or Multiple processors 110 execute, and one or more programs are configured to execute the method described in the foregoing method embodiment.
  • the processor 110 may include one or more processing cores.
  • the processor 110 uses various interfaces and lines to connect various parts of the entire server 100, and executes the server by running or executing instructions, programs, code sets, or instruction sets stored in the memory 120, and calling data stored in the memory 120. 100's various functions and processing data.
  • the processor 110 may adopt at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA).
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PDA Programmable Logic Array
  • the processor 110 may be integrated with one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a modem, and the like.
  • the CPU mainly processes the operating system, user interface, and application programs; the GPU is used for rendering and drawing the content to be displayed; the modem is used for processing wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 110, but may be implemented by a communication chip alone.
  • the memory 120 may include random access memory (RAM) or read-only memory (Read-Only Memory).
  • the memory 120 may be used to store instructions, programs, codes, code sets or instruction sets.
  • the memory 120 may include a program storage area and a data storage area, where the program storage area may store instructions for implementing the operating system and instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.) , Instructions used to implement the following various method embodiments, etc.
  • the storage data area can also store data (such as phone book, audio and video data, chat record data) created by the server 100 during use.
  • FIG. 11 shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application.
  • the computer-readable medium 300 stores program code, and the program code can be invoked by a processor to execute the method described in the foregoing method embodiment.
  • the computer-readable storage medium 300 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • the computer-readable storage medium 300 includes a non-transitory computer-readable storage medium.
  • the computer-readable storage medium 300 has storage space for the program code 310 for executing any method steps in the above-mentioned methods. These program codes can be read from or written into one or more computer program products.
  • the program code 510 may be compressed in an appropriate form, for example.
  • the shunt method, device, server, and storage medium obtained current shunt information, where the current shunt information includes the preset shunt ratio corresponding to each experimental version of the multiple experimental versions and each The number of diversions corresponding to each experimental version is calculated, the preset diversion ratio corresponding to each experimental version and the number of diversions corresponding to each experimental version are calculated, and the diversion priority coefficient corresponding to each experimental version is obtained, based on the correspondence of each experimental version
  • the diversion priority coefficient of determines the target experimental version from multiple experimental versions, and drains to the target experimental version, so as to obtain the diversion priority coefficient corresponding to each experimental version by calculating the preset diversion ratio and the number of diversions corresponding to each experimental version , And determine the target experimental version for drainage according to the diversion priority coefficient, so that the flow can be indiscriminately close to the preset diversion ratio, and be allocated to each experimental version.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

本申请公开了一种分流方法、装置、服务器以及存储介质,涉及分流技术领域。获取当前分流信息,其中,当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数,对每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数进行计算,获得每个实验版本对应的分流优先系数,基于每个实验版本对应的分流优先系数,从多个实验版本中确定目标实验版本,向目标实验版本引流。本申请实施例通过对各个实验版本对应的预设分流比例和已分流次数进行计算,获得各个实验版本对应的分流优先系数,并根据分流优先系数确定目标实验版本进行引流,使流量可以无差别的贴近预设的分流比例,被分配到各个实验版本中。

Description

分流方法、装置、服务器以及存储介质 技术领域
本申请涉及分流技术领域,更具体地,涉及一种分流方法、装置、服务器以及存储介质。
背景技术
在互联网时代,不管是各种推荐系统,各个应用程序,还是各种网站系统的更新迭代必然需要建立一套衡量实验机制,来把控整个流程优化的方向。
发明内容
鉴于上述问题,本申请提出了一种分流方法、装置、服务器以及存储介质,以解决上述问题。
第一方面,本申请实施例提供了一种分流方法,所述方法包括:获取当前分流信息,其中,所述当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数;对所述每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数进行计算,获得所述每个实验版本对应的分流优先系数;基于所述每个实验版本对应的分流优先系数,从所述多个实验版本中确定目标实验版本;向所述目标实验版本引流。
第二方面,本申请实施例提供了一种分流装置,所述装置包括:当前分流信息获取模块,用于获取当前分流信息,其中,所述当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数;分流优先系数获得模块,用于对所述每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数进行计算,获得所述每个实验版本对应的分流优先系数;目标实验版本确定模块,用于基于所述每个实验版本对应的分流优先系数,从所述多个实验版本中确定目标实验版本;引流模块,用于向所述目标实验版本引流。
第三方面,本申请实施例提供了一种服务器,包括存储器和处理器,所述存储器耦接到所述处理器,所述存储器存储指令,当所述指令由所述处理器执行时所述处理器执行上述方法。
第四方面,本申请实施例提供了一种计算机可读取存储介质,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行上述方法。
本申请实施例提供的分流方法、装置、服务器以及存储介质,获取当前分流信息,其中,当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数,对每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数进行计算,获得每个实验版本对应的分流优先系数,基于每个实验版本对应的分流优先系数,从多个实验版本中确定目标实验版本,向目标实验版本引流,从而通过对各个实验版本对应的预设分流比例和已分流次数进行计算,获得各个实验版本对应的分流优先系数,并根据分流优先系数确定目标实验版本进行引流,使流量可以无差别的贴近预设的分流比例,被分配到各个实验版本中。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。
图1示出了本申请一个实施例提供的分流方法的流程示意图;
图2示出了本申请又一个实施例提供的分流方法的流程示意图;
图3示出了本申请再一个实施例提供的分流方法的流程示意图;
图4示出了本申请的图3所示的分流方法的步骤S304的流程示意图;
图5示出了本申请另一个实施例提供的分流方法的流程示意图;
图6示出了本申请又再一个实施例提供的分流方法的流程示意图;
图7示出了本申请的图6所示的分流方法的步骤S504的流程示意图;
图8示出了本申请又另一个实施例提供的分流方法的流程示意图;
图9示出了本申请实施例提供的分流装置的模块框图;
图10示出了本申请实施例用于执行根据本申请实施例的分流方法的服务器的框图;
图11示出了本申请实施例的用于保存或者携带实现根据本申请实施例的分流方法的程序代码的存储单元。
具体实施方式
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。
在互联网时代,不管是各种推荐系统,各种应用程序,还是各种网站系统的更新迭代必然需要 建立一套衡量实验机制,来把控整个流程优化的方向。而ABtest系统就是一种最为常见的进行变量控制和优化方向选取的工具,其中,AB Test可以理解为我们经常会面临多个设计方案或者算法的选择,比如应用程序或电子设备的某个界面的某个按钮是用红色还是用蓝色,推荐算法A和推荐算法B哪个效果好,也就是说,所谓A/B测试就是为同一个目标制定多个方案,以两个方案为例(比如两个页面,当然实际中往往参与实验的会有多个方案),让一部分用户使用A方案,另一部分用户使用B方案,记录下用户的使用情况,看哪个方案更符合设计目标。
目前,通常是通过获取用户访问请求的访问标识ID信息(如设备号、用户账号等唯一ID信息),然后根据选择好的Hash算法,计算出访问ID信息对应的数值,将数值取余后作为用户访问请求对应的版本号返回对应版本的页面或数据。其中,Hash,一般音译为哈希,是把任意长度的输入(又叫做预映射pre-image)通过散列算法变换成固定长度的输出,该输出就是散列值,这种转换是一种压缩映射,也就是说,散列值的空间通常远小于输入的空间,不同的输入可能会散列成相同的输出,所以不可能从散列值来确定唯一的输入值,简单的说就是一种将任意长度的消息压缩到某一固定长度的消息摘要的函数。举例说明:针对每个访问ABtest实验页面的用户,计算其访问ID信息的Hash值,并得到其对100取模的余数即0-99,假设ABCD四个版本流量为10:70:10:10,则余数0-9为A版、10-79为B版、80-89为C版、90-99为D版。
然而,发明人经过研究发现,采用上述方式至少存在以下问题:
1、依赖所选择Hash算法的随机性和均匀性
用户访问ID可能具有一定的相似性,比如系统自动生成的账号,相同批次或地区的用户其账号可能比较相似。为了体现分流方法的随机性,必须要求Hash算法生成的Hash值尽量随机和均匀分布。若无法保证随机和均匀分布,则可能使得同一批次或同一地区的用户被分到同一版本上,造成分流不均。Hash算法的选择同时也影响了实际的分流比例,只有当Hash值足够达到充分的随机均匀分布,实际分流比例才会趋向于预先设置的比例。
2、依赖分流样本数的大小
在满足上述第一点的前提下,就算选择了一个十分均匀和随机的Hash算法,但如果参与分流样本的数量太小,则很可能最后分流的结果会与预设的不同版本的分流比例相去甚远。所以当前分流技术方案除了依赖于hash算法的选择同时也依赖于分流样本量的大小。只有当分流样本量达到一定规模后,才可以使实际分流结果趋近于预设的分流比例。
针对上述问题,发明人经过长期的研究发现,并提出了本申请实施例提供的分流方法、装置、服务器以及存储介质,通过对各个实验版本对应的预设分流比例和已分流次数进行计算,获得各个实验版本对应的分流优先系数,并根据分流优先系数确定目标实验版本进行引流,使流量可以无差别的贴近预设的分流比例,被分配到各个实验版本中。其中,具体的分流方法在后续的实施例中进行详细的说明。
请参阅图1,图1示出了本申请一个实施例提供的分流方法的流程示意图。所述分流方法用于通过对各个实验版本对应的预设分流比例和已分流次数进行计算,获得各个实验版本对应的分流优先系数,并根据分流优先系数确定目标实验版本进行引流,使流量可以无差别的贴近预设的分流比例,被分配到各个实验版本中。在具体的实施例中,所述分流方法应用于如图9所示的分流装置200以及配置有分流装置200的服务器100(图10)。下面将以服务器为例,说明本实施例的具体流程,当然,可以理解的,本实施例所应用的服务器可以为云服务器、也可以为传统服务器等,在此不做限定。下面将针对图1所示的流程进行详细的阐述,所述分流方法具体可以包括以下步骤:
步骤S101:获取当前分流信息,其中,所述当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数。
在本实施例中,可以预先设置多个实验版本,并对多个实验版本进行测试。例如,以多个实验版本的数量为三个,且三个实验版本分别为第一实验版本、第二实验版本以及第三实验版本为例,则可以对第一实验版本、第二实验版本以及第三实验版本进行测试。
作为一种方式,假设第一实验版本基于第一设计方案生成、第二实验版本基于第二设计方案生成、第三实验版本基于第三设计方案生成,则可以对第一实验版本、第二实验版本、第三实验版本进行测试,以根据测试结果从中选取更符合测试目标的实验版本,并采用该更符合测试目标的实验版本对应的设计方案进行后续实验版本的设计,例如,若第一实验版本为更符合测试目标的实验版本,则可以采用第一设计方案进行后续实验版本的设计。
作为另一种方式,假设第一实验版本基于第一算法生成、第二实验版本基于第二算法生成、第三实验版本基于第三算法生成,则可以对第一实验版本、第二实验版本、第三实验版本进行测试,以根据测试结果从中选取更符合测试目标的实验版本,并采用该更符合测试目标的实验版本对应的设计方案进行后续实验版本的设计,例如,若第一实验版本为更符合测试目标的实验版本,则可以采用第一算法进行后续实验 版本的生成。
在一些实施方式中,在设置多个实验版本后,可以设置多个实验版本中的每个实验版本对应的分流比例作为预设分流比例,其中,所设置的每个实验版本对应的分流比例可以相同,也可以不相同。例如,当多个实验版本包括第一实验版本、第二实验版本以及第三实验版本时,则第一实验版本、第二实验版本以及第三实验版本对应的分流比例可以相同,均为1/3。又例如,当多个实验版本包括第一实验版本、第二实验版本以及第三实验版本时,则第一实验版本、第二实验版本对应的分流比例可以不相同,如第一实验版本对应的分流比例为0.2,第二实验版本对应的分流比例为0.7,第三实验版本对应的分流比例为0.1,在此不做限定。
在本实施例中,可以获取当前分流信息,其中,该当前分流信息可以包括多个实验版本中的每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数。其中,在一些实施方式中,由于每个实验版本对应的预设分流比例固定且预先设置完成,因此,可以直接获取每个实验版本对应的预设分流比例。在一些实施方式中,在进行实验版本的测试之前,每个实验版本均没有进行过分流,因此,在进行实验版本的测试之前,每个实验版本对应的已分流次数均为零,在进行实验版本的测试的过程中,每个实验版本可能均已进行过分流,也可能部分实验版本进行过分流,其余部分实验版本没有进行过分流,因此,在进行实验版本的过程中,可以记录每个实验版本的已分流次数并保存,可以基于记录并保存的每个实验版本的已分流次数获取每个实验版本的已分流次数。
在一些实施方式中,该当前分流信息可以集中存储在Redis中,保证其在分布式部署环境中的使用。其中,Redis(全称:Remote Dictionary Server,远程字典服务)是一个开源的使用ANSI C语言编写、支持网络、可基于内存亦可持久化的日志型、Key-Value数据库,并提供多种语言的API。
步骤S102:对所述每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数进行计算,获得所述每个实验版本对应的分流优先系数。
在本实施例中,在获取当前分流信息中的每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数后,可以对每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数进行计算,以获得每个实验版本对应的分流优先系数。在一些实施方式中,在获取当前分流信息中的每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数后,可以基于预设公式对每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数进行计算,以获得每个实验版本对应的分流优先系数。
在一些实施方式中,在获得每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数后,可以基于
Figure PCTCN2020087065-appb-000001
对每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数进行计算,获得每个实验版本对应的分流优先系数c i,其中,k表示实验版本的数量,r i表示第i个实验版本对应的预设分流比例,n i表示第i个实验版本对应的已分流次数。
其中,该分流优先系数可以用于反应预设分流比例和实际分流比例之间的差值。因此,实验版本对应的分流优先系数越大,表明该实验版本被分流到的次数越少,未能达到预设分流比例,所以每次分流可以优先给优先系数最大的实验版本分配流量,同样地,当实验版本对应的实际分流次数逐渐增多,该实验版本对应的分类优先系数便会相应减小,使得其被分流到的几率减小,从而达到动态平衡的效果,让每一次分流都趋近于预设分流比例。
在一些实施方式中,当实验版本对应的分流比例设置为0时,其对应的分流优先系数可以设置为-1,保证其不会被分流到。
步骤S103:基于所述每个实验版本对应的分流优先系数,从所述多个实验版本中确定目标实验版本。
在本实施例中,在获得每个实验版本对应的分流优先系数后,可以基于该每个实验版本对应的分流优先系数,从多个实验版本中确定目标实验版本中确定目标实验版本,其中,所确定的目标实验版本为被分流次数较少,未能达到预设分流比例的实验版本。
在一些实施方式中,在获得每个实验版本对应的分流优先系数后,可以获取分流优先系数中最大的分流优先系数,并获取分流优先系数中最大的分流优先系数对应的实验版本,将分流优先系数中最大的分流优先系数对应的实验版本确定为目标实验版本。在一些实施方式中,在获得每个实验版本对应的分流优先系数后,可以基于每个实验版本对应的分流优先系数从大到小的顺序对多个实验版本进行排序,将排序在 首位的实验版本确定为目标实验版本。
步骤S104:向所述目标实验版本引流。
在本实施例中,在从多个实验版本中确定目标实验版本后,可以向目标实验版本引流,以增加目标实验版本的分流次数,使目标实验版本的实际分流比例趋近于预设分流比例,以达到测试目标。在一些实施方式中,向目标实验版本引流可以向用户推送目标实验版本,也可以包括在接收到访问请求时,通过目标实验版本对访问请求进行处理等,在此不做限定。
在一些实施方式中,可以通过Redis中的incr命令向目标实验版本引流,即使用Redis中的incr命令对目标实验版本的分流次数进行自增操作。
本申请一个实施例提供的分流方法,获取当前分流信息,其中,当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数,对每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数进行计算,获得每个实验版本对应的分流优先系数,基于每个实验版本对应的分流优先系数,从多个实验版本中确定目标实验版本,向目标实验版本引流,从而通过对各个实验版本对应的预设分流比例和已分流次数进行计算,获得各个实验版本对应的分流优先系数,并根据分流优先系数确定目标实验版本进行引流,使流量可以无差别的贴近预设的分流比例,被分配到各个实验版本中。
请参阅图2,图2示出了本申请又一个实施例提供的分流方法的流程示意图。下面将针对图2所示的方法进行详细的阐述,所述分流方法具体可以包括以下步骤:
步骤S201:获取当前分流信息,其中,所述当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数。
步骤S202:对所述每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数进行计算,获得所述每个实验版本对应的分流优先系数。
其中,步骤S201-步骤S202的具体描述请参阅步骤S101-步骤S102,在此不再赘述。
步骤S203:基于所述每个实验版本对应的分流优先系数,获取所述每个实验版本对应的预设分流比例和当前分流比例之间的差值。
在本实施例中,在获得每个实验版本对应的分流优先系数后,可以基于每个实验版本对应的分流优先系数,获取每个实验版本对应的预设分流比例和当前分流比例之间的差值。
在一些实施方式中,每个实验版本对应的分流优先系数可以通过
Figure PCTCN2020087065-appb-000002
计算得到,因此,在r i>0时,该分流优先系数为:
Figure PCTCN2020087065-appb-000003
其中,
Figure PCTCN2020087065-appb-000004
表示第i个实验版本对应的预设分流比例,
Figure PCTCN2020087065-appb-000005
为第i个实验版本对应的当前分流比例,从而可以获取每个实验版本对应的预设分流比例和当前分流比例之间的差值。
步骤S204:基于所述每个实验版本对应的预设分流比例和当前分流比例之间的差值,从所述多个实验版本中确定目标实验版本。
其中,当实验版本对应的预设分流比例和当前分流比例之间的差值越大,表示该实验版本被分流到的次数越少,未能达到预设分流比例,当实验版本对应的预设分流比例和当前分流比例之间的差值越小,表示该实验版本被分流到的次数越多,基本达到预设分流比例。因此,可以将实验版本对应的预设分流比例和当前分流比例之间的差值作为确定目标实验版本的依据。在本实施例中,在获得每个实验版本对应的预设分流比例和当前分流比例之间的差值后,可以基于每个实验版本对应的预设分流比例和当前分流比例之间的差值,从多个实验版本中确定目标实验版本。
在一些实施方式中,由于实验版本对应的预设分流比例和当前分流比例之间的差值越大,表示该实验版本被分流到的次数越少,因此,从多个实验版本中确定目标实验版本可以包括:从多个实验版本中获取每个实验版本对应的预设分流比例和当前分流比例之间的差值,并将预设分流比例和当前分流比例之间的差值最大的实验版本确定为目标实验版本。
步骤S205:向所述目标实验版本引流。
其中,步骤S205的具体描述请参阅步骤S104,在此不再赘述。
本申请又一个实施例提供的分流方法,获取当前分流信息,其中,当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数,对每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数进行计算,获得每个实验版本对应的分流优先系数,基于每个实验版本对应的分流优先系数,获取每个实验版本对应的预设分流比例和当前分流比例之间的差值,基于每个实验版本对应的预设分流比例和当前分流比例之间的差值,从多个实验版本中确定目标实验版本,向目标实验版本引流。相较于图1所示的分流方法,本实施例还根据每个实验版本对应的分流优先系数,获取每个实验版本对应的预设分流比例和当前分流比例之间的差值,并基于该差值确定目标实验版本,从而提升目标实验版本确定的准确性和分流的合理性,以更贴合设置的分流需求。
请参阅图3,图3示出了本申请再一个实施例提供的分流方法的流程示意图。下面将针对图3所示的流程进行详细的阐述,所述分流方法具体可以包括以下步骤:
步骤S301:获取当前分流信息,其中,所述当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数。
步骤S302:对所述每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数进行计算,获得所述每个实验版本对应的分流优先系数。
其中,步骤S301-步骤S302的具体描述请参阅步骤S101-步骤S102,在此不再赘述。
步骤S303:基于所述每个实验版本对应的分流优先系数,对所述多个实验版本进行排序。
在本实施例中,在获得每个实验版本对应的分流优先系数后,可以基于每个实验版本对应的分流优先系数,对多个实验版本进行排序。在一些实施方式中,在获得每个实验版本对应的分流优先系数后,可以基于每个实验版本对应的分流优先系数,按分流优先系数从大到小的顺序对多个实验版本进行排序。例如,假设实验版本包括第一实验版本、第二实验版本以及第三实验版本,且第一实验版本对应第一分流优先系数、第二实验版本对应第二分流优先系数以及第三实验版本对应第三分流优先系数,那么,若第一分流优先系数>第二分流优先系数>第三分流优先系数,则对第一实验版本、第二实验版本以及第三实验版本进行排序可以得到:第一实验版本-第二实验版本-第三实验版本。
步骤S304:基于所述多个实验版本的排序顺序,从所述多个实验版本中确定目标实验版本。
在本实施例中,在对多个实验版本进行排序后,可以获得多个实验版本的排序顺序,则可以基于多个实验版本的排序顺序,从多个实验版本中确定目标实验版本。其中,当多个实验版本的排序顺序是按照对应的分流优先系数从大到小的顺序时,则可以从多个实验版本中确定排序在首位的实验版本作为目标实验版本,当多个实验版本的排序顺序是按照对应的分流优先系数从小到大的顺序时,则可以从多个实验版本中确定排序在末位的实验版本作为目标实验版本。
请参阅图4,图4示出了本申请的图3所示的分流方法的步骤S304的流程示意图。下面将针对图4所示的流程进行详细的阐述,所述方法具体可以包括以下步骤:
步骤S3041:基于所述多个实验版本的排序顺序,获取排序顺序在首位的实验版本。
在本实施例中,基于每个实验版本对应的分流优先系数,按分流优先系数从大到小的顺序对多个实验版本进行排序。因此,实验版本的排序顺序越靠前,表示该实验版本对应的分流优先系数越大,该实验版本被分流到的次数越少,未能达到预设分流比例,实验版本的排序顺序越靠后,表示该实验版本对应的分流优先系数越小,该实验版本被分流到的次数越多,基本靠近预设分流比例。因此,排序顺序在首位的实验版本对应的分流优先系数最大,被分流到的次数最少,与预设分流比例的差距最大,因此,可以获取该排序在首位的实验版本,并将该排序在首位的实验版本确定为目标实验版本。
步骤S3042:将所述排序顺序在首位的实验版本确定为所述目标实验版本。
步骤S305:向所述目标实验版本引流。
其中,步骤S305的具体描述请参阅步骤S104,在此不再赘述。
本申请再一个实施例提供的分流方法,获取当前分流信息,其中,当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数,对每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数进行计算,获得每个实验版本对应的分流优先系数,基于每个实验版本对应的分流优先系数,对多个实验版本进行排序,基于多个实验版本的排序顺序,从多个实验版本中确定目标实验版本,向目标实验版本引流。相较于图1所示的分流方法,本实施例还根据每个实验版本对应的分流优先系数,对多个实验版本进行排序,并根据排序顺序确定目标实验版本,从而提升目标实验版本确定的准确性和分流的合理性,以更贴合设置的分流需求。
请参阅图5,图5示出了本申请另一个实施例提供的分流方法的流程示意图。下面将针对图5所示的流程进行详细的阐述,所述分流方法具体可以包括以下步骤:
步骤S401:获取当前分流信息,其中,所述当前分流信息包括多个实验版本中的每个实验版本对应 的预设分流比例和所述每个实验版本对应的已分流次数。
步骤S402:对所述每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数进行计算,获得所述每个实验版本对应的分流优先系数。
其中,步骤S401-步骤S402的具体描述请参阅步骤S101-步骤S102,在此不再赘述。
步骤S403:基于所述每个实验版本对应的分流优先系数,从所述多个实验版本中获取分流优先系数最大的实验版本。
在本实施例中,在获得每个实验版本对应的分流优先系数后,可以基于每个实验版本对应的分流优先系数,从多个实验版本中获取分流优先系数最大的实验版本。在一些实施方式中,在获得每个实验版本对应的分流优先系数后,可以将每个实验版本对应的分流优先系数进行大小比较,以从中获取最大的分流优先系数,并获取该最大的分流优先系数对应的实验版本。其中,实验版本对应的分流优先系数最大,表示该实验版本被分流到的次数最少,与预设分流比例的差距最大,因此,可以从多个实验版本中获取分流优先系数最大的实验版本,并将该分流优先系数最大的实验版本确定为目标实验版本。
步骤S404:将所述分流优先系数最大的实验版本确定为所述目标实验版本。
步骤S405:向所述目标实验版本引流。
其中,步骤S405的具体描述请参阅步骤S104,在此不再赘述。
本申请另一个实施例提供的分流方法,获取当前分流信息,其中,当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数,对每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数进行计算,获得每个实验版本对应的分流优先系数,基于每个实验版本对应的分流优先系数,从多个实验版本中获取分流优先系数最大的实验版本,将分流优先系数最大的实验版本确定为目标实验版本,向目标实验版本引流。相较于图1所示的分流方法,本实施例还根据每个实验版本对应的分流优先系数,从多个实验版本中将分流优先系数最大的实验版本确定为目标实验版本,从而提升目标实验版本确定的准确性和分流的合理性,以更贴合设置的分流需求。
请参阅图6,图6示出了本申请又再一个实施例提供的分流方法的流程示意图。下面将针对图6所示的流程进行详细的阐述,所述分流方法具体可以包括以下步骤:
步骤S501:获取当前分流信息,其中,所述当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数。
步骤S502:对所述每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数进行计算,获得所述每个实验版本对应的分流优先系数。
步骤S503:基于所述每个实验版本对应的分流优先系数,从所述多个实验版本中确定目标实验版本。
其中,步骤S501-步骤S503的具体描述请参阅步骤S101-步骤S103,在此不再赘述。
步骤S504:当所述每个实验版本对应的已分流次数均为零时,基于所述每个实验版本对应的预设分流比例,从所述多个实验版本中确定所述目标实验版本。
在本实施例中,在获得每个实验版本对应的已分流次数后,可以分别检测每个实验版本对应的已分流次数是否为零,其中,当检测结果表征每个实验版本对应的已分流次数均为零时,则可以基于每个实验版本对应的预设分流比例,从多个实验版本中确定目标实验版本。在一些实施方式中,当每个实验版本对应的已分流次数均为零时,则可以基于每个实验版本对应的预设分流比例的大小关系,从多个实验版本中确定目标实验版本。
请参阅图7,图7示出了本申请的图6所示的分流方法的步骤S504的流程示意图。下面将针对图7所示的流程进行详细的阐述,所述方法具体可以包括以下步骤:
步骤S5041:当所述每个实验版本对应的已分流次数均为零时,从所述多个实验版本中获取预设分流比例最大的实验版本。
其中,预设分流比例最大的实验版本所需进行分流的次数最多,预设分流比例最小的实验版本所需进行分流的次数最少。因此,在本实施例中,当每个实验版本对应的已分流次数均为零时,则可以从多个实验版本中获取预设分流比例最大的实验版本,并将预设分流比例最大的实验版本确定为目标实验版本,以优先对所需分流次数最大的实验版本进行分流。
步骤S5042:将所述预设分流比例最大的实验版本确定为所述目标实验版本。
步骤S505:向所述目标实验版本引流。
其中,步骤S505的具体描述请参阅步骤S104,在此不再赘述。
本申请又再一个实施例提供的分流方法,获取当前分流信息,其中,当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数,对每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数进行计算,获得每个实验版本对应的分流优先系数,基于每个实验版本对应的分流优先系数,从多个实验版本中确定目标实验版本,当每个实 验版本对应的已分流次数均为零时,基于每个实验版本对应的预设分流比例,从多个实验版本中确定目标实验版本,向目标实验版本引流。相较于图1所示的分流方法,本实施例还在每个实验版本对应的已分流次数均为零时,通过每个实验版本对应的预设分流比例确定目标实验版本,从而提升目标实验版本确定的准确性和分流的合理性,以更贴合设置的分流需求。
请参阅图8,图8示出了本申请又另一个实施例提供的分流方法的流程示意图。下面将针对图8所示的流程进行详细的阐述,所述分流方法具体可以包括以下步骤:
步骤S601:获取当前分流信息,其中,所述当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数。
步骤S602:对所述每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数进行计算,获得所述每个实验版本对应的分流优先系数。
步骤S603:基于所述每个实验版本对应的分流优先系数,从所述多个实验版本中确定目标实验版本。
步骤S604:向所述目标实验版本引流。
其中,步骤S601-步骤S604的具体描述请参阅步骤S101-步骤S104,在此不再赘述。
步骤S605:获取向所述目标实验版本引流的访问流量对应的用户标识信息。
在本实施例中,在向目标实验版本引流后,可以获取向目标实验版本引流的访问流量对应的用户标识信息。其中,向目标实验版本引流的访问流量可以是用户触发生成,也可以是服务器向用户推送生成,在此不做限定。在一些实施方式中,该用户标识信息可以为用户使用的设备ID、用户的账户ID等用于唯一标识该用户的标识信息,在此不做限定。
步骤S606:将所述用户标识信息缓存到Redis中。
在本实施例中,在获取向目标实验版本引流的访问流量对应的用户标识信息后,可以将该用户标识信息缓存到Redis中,以保证用户标识信息可以在分布式部署环境中使用。
在一些实施方式中,在获取向目标实验版本引流的访问流量对应的用户标识信息后,可以将用户标识信息和目标实验版本以键值对(key-value)的方式缓存到Redis中。例如,可以以:用户标识1-目标实验版本1、用户标识2-目标实验版本2……的方式缓存到Redis中。
步骤S607:设置所述用户标识信息的缓存过期时间。
在本实施例中,在将用户标识信息缓存到Redis中后,可以设置该用户标识信息的缓存过期时间。其中,该缓存过期时间的时长可以为一天、一个星期、一个月等,在此不做限定。
步骤S608:若在所述缓存过期时间内接收到所述用户标识信息的访问请求时,延迟所述用户标识信息的缓存过期时间。
在本实施例中,若在缓存过期时间内接收到该用户标识信息的访问请求时,则可以延迟用户标识信息的缓存过期时间。例如,若在过期时间内接收到该用户标识信息的访问请求时,可以重新设置原缓存过期时间,也可以在原缓存过期时间的基础上增加一定时长,在此不做限定。
步骤S609:若在所述缓存过期时间内没有接收到所述用户标识信息的访问请求时,从Redis中删除所述用户标识信息。
在本实施例中,若在缓存过期时间内没有接收到该用户标识信息的访问请求时,则可以从Redis中删除该用户标识信息,以释放存储空间。
步骤S610:获取所述每个实验版本对应的当前已分流次数。
在本实施例中,在向目标实验版本引流后,可以获取每个实验版本的当前已分流次数。例如,假设多个实验版本包括第一实验版本、第二实验版本以及第三实验版本,且第一实验版本为目标实验版本,若在向第一实验版本引流之前,第一实验版本对应的已分流次数为10次,第二实验版本对应的已分流次数为20次,第三实验版本对应的已分流次数为30次,那么,在向第一实验版本进行1次引流之后,则第一实验版本对应的当前已分流次数为11次,第二实验版本对应的当前已分流次数为20次,第三实验版本对应的当前已分流次数为30次。
步骤S611:将所述每个实验版本对应的当前已分流次数缓存到Redis中。
在本实施例中,在获得每个实验版本对应的当前已分流次数后,可以将每个实验版本对应的当前已分流次数缓存到Redis中,以保证每个实验版本的当前已分流次数可以在分布式部署环境中使用。
在一些实施方式中,还可以获取每个实验版本对应的版本标识信息,并将每个实验版本对应的版本标识信息和每个实验版本对应的当前分流次数以键值对(key-value)的方式缓存到Redis中。例如,可以以:版本标识1-已分流次数1、版本标识2-已分流次数2……的方式缓存到Redis中。
步骤S612:基于所述每个实验版本的当前已分流次数,更新所述当前分流信息。
在本实施例中,在获取每个实验版本的当前已分流次数后,可以更新当前分流信息,具体地,在获取每个实验版本的当前已分流次数后,可以将当前分流信息中的每个实验版本的已分流次数更新为当前已分流次数,以动态的对各个实验版本的分类次数进行调整。
本申请又另一个实施例提供的分流方法,获取当前分流信息,其中,当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数,对每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数进行计算,获得每个实验版本对应的分流优先系数,基于每个实验版本对应的分流优先系数,从多个实验版本中确定目标实验版本,向目标实验版本引流,获取向目标实验版本引流的访问流量对应的用户标识信息,将用户标识信息缓存到Redis中,设置用户标识信息的缓存过期时间,若在缓存过期时间内接收到用户标识信息的访问请求时,延迟用户标识信息的缓存过期时间,若在缓存过期时间内没有接收到用户标识信息的访问请求时,从Redis中删除用户标识信息,获取每个实验版本对应的当前已分流次数,将每个实验版本对应的当前已分流次数缓存到Redis中,基于每个实验版本的当前已分流次数,更新当前分流信息。相较于图1所示的分流方法,本实施例还将向目标实验版本引流的访问流量对应的用户标识信息、每个实验版本对应的当前已分流次数缓存到Redis中,以保证其在分布式部署环境中使用。另外,本实施例对当前分流信息进行更新,以供下一次引流提供参考,提升分流的合理性,以更贴合设置的分流需求。
请参阅图9,图9示出了本申请实施例提供的分流装置200的模块框图。下面将针对图9所示的框图进行阐述,所述分流装置200包括:当前分流信息获取模块210、分流优先系数获得模块220、目标实验版本确定模块230以及引流模块240,其中:
当前分流信息获取模块210,用于获取当前分流信息,其中,所述当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数。
分流优先系数获得模块220,用于对所述每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数进行计算,获得所述每个实验版本对应的分流优先系数。
进一步地,所述分流优先系数获得模块220包括:分流优先系数获得子模块,其中:
分流优先系数获得子模块,用于基于
Figure PCTCN2020087065-appb-000006
对所述每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数进行计算,获得所述每个实验版本对应的分流优先系数c i,其中,k表示实验版本的数量,r i表示第i个实验版本对应的预设分流比例,n i表示第i个实验版本对应的已分流次数。
目标实验版本确定模块230,用于基于所述每个实验版本对应的分流优先系数,从所述多个实验版本中确定目标实验版本。
进一步地,所述目标实验版本确定模块230包括:差值获取子模块和第一目标实验版本确定子模块,其中:
差值获取子模块,用于基于所述每个实验版本对应的分流优先系数,获取所述每个实验版本对应的预设分流比例和当前分流比例之间的差值。
第一目标实验版本确定子模块,用于基于所述每个实验版本对应的预设分流比例和当前分流比例之间的差值,从所述多个实验版本中确定目标实验版本。
进一步地,所述目标实验版本确定模块230包括:排序子模块和第二目标实验版本确定子模块,其中:
排序子模块,用于基于所述每个实验版本对应的分流优先系数,对所述多个实验版本进行排序。
进一步地,所述排序子模块包括:排序单元,其中:
排序单元,用于基于所述每个实验版本对应的分流优先系数,按分流优先系数从大到小的顺序对所述多个实验版本进行排序。
第二目标实验版本确定子模块,用于基于所述多个实验版本的排序顺序,从所述多个实验版本中确定目标实验版本。
进一步地,所述第二目标实验版本确定子模块包括:首位实验版本获取单元和目标实验版本确定单元,其中:
首位实验版本获取单元,用于基于所述多个实验版本的排序顺序,获取排序顺序在首位的实验版本。
目标实验版本确定单元,用于将所述排序顺序在首位的实验版本确定为所述目标实验版本。
进一步地,所述目标实验版本确定模块230包括:分流优先系数最大实验版本获取子模块和第三目标实验版本确定子模块,其中:
分流优先系数最大实验版本获取子模块,用于基于所述每个实验版本对应的分流优先系数,从所述多个实验版本中获取分流优先系数最大的实验版本。
第三目标实验版本确定子模块,用于将所述分流优先系数最大的实验版本确定为所述目标实验版本。
引流模块240,用于向所述目标实验版本引流。
进一步地,所述引流模块240包括:引流子模块,其中:
引流子模块,用于通过Redis中的incr命令向所述目标实验版本引流。
进一步地,所述分流装置200还包括:目标实验版本获取模块,其中:
目标实验版本获取模块,用于当所述每个实验版本对应的已分流次数均为零时,基于所述每个实验版本对应的预设分流比例,从所述多个实验版本中确定所述目标实验版本。
进一步地,所述目标实验版本获取模块包括:预设分流比例最大实验版本获取子模块和目标实验版本获取子模块,其中:
预设分流比例最大实验版本获取子模块,用于当所述每个实验版本对应的已分流次数均为零时,从所述多个实验版本中获取预设分流比例最大的实验版本。
目标实验版本获取子模块,用于将所述预设分流比例最大的实验版本确定为所述目标实验版本。
进一步地,所述分流装置200还包括:用户标识信息获取模块和用户标识信息缓存模块,其中:
用户标识信息获取模块,用于获取向所述目标实验版本引流的访问流量对应的用户标识信息。
用户标识信息缓存模块,用于将所述用户标识信息缓存到Redis中。
进一步地,所述用户标识信息缓存模块包括:用户标识信息缓存子模块,其中:
用户标识信息缓存子模块,用于将所述用户标识信息和所述目标实验版本以键值对的方式缓存到Redis中。
进一步地,所述分流装置200还包括:缓存过期时间设置模块,其中:
缓存过期时间设置模块,用于设置所述用户标识信息的缓存过期时间。
进一步地,所述分流装置200还包括:缓存过期时间延迟模块和用户标识信息删除模块,其中:
缓存过期时间延迟模块,用于若在所述缓存过期时间内接收到所述用户标识信息的访问请求时,延迟所述用户标识信息的缓存过期时间。
用户标识信息删除模块,用于若在所述缓存过期时间内没有接收到所述用户标识信息的访问请求时,从Redis中删除所述用户标识信息。
进一步地,所述分流装置200还包括:当前已分流次数获取模块和当前已分流次数缓存模块,其中:
当前已分流次数获取模块,用于获取所述每个实验版本对应的当前已分流次数。
当前已分流次数缓存模块,用于将所述每个实验版本对应的当前已分流次数缓存到Redis中。
进一步地,所述当前已分流次数缓存模块包括:版本标识信息获取子模块和当前已分流次数缓存子模块,其中:
版本标识信息获取子模块,用于获取所述每个实验版本对应的版本标识信息。
当前已分流次数缓存子模块,用于将所述每个实验版本对应的版本标识信息和所述每个实验版本对应的当前分流次数以键值对的方式缓存到Redis中。
进一步地,所述分流装置200还包括:当前分流信息更新模块,其中:
当前分流信息更新模块,用于基于所述每个实验版本的当前已分流次数,更新所述当前分流信息。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述装置和模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,模块相互之间的耦合可以是电性,机械或其它形式的耦合。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
请参阅图10,其示出了本申请实施例提供的一种服务器100的结构框图。该服务器100可以是智能手机、平板电脑、电子书等能够运行应用程序的服务器。本申请中的服务器100可以包括一个或多个如下部件:处理器110、存储器120以及一个或多个应用程序,其中一个或多个应用程序可以被存储在存储器120中并被配置为由一个或多个处理器110执行,一个或多个程序配置用于执行如前述方法实施例所描述的方法。
其中,处理器110可以包括一个或者多个处理核。处理器110利用各种接口和线路连接整个服务器100内的各个部分,通过运行或执行存储在存储器120内的指令、程序、代码集或指令集,以及调用存储在存储器120内的数据,执行服务器100的各种功能和处理数据。可选地,处理器110可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable  Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器110可集成中央处理器(Central Processing Unit,CPU)、图形处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责待显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器110中,单独通过一块通信芯片进行实现。
存储器120可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。存储器120可用于存储指令、程序、代码、代码集或指令集。存储器120可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。存储数据区还可以存储服务器100在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。
请参阅图11,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读介质300中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。
计算机可读存储介质300可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质300包括非易失性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质300具有执行上述方法中的任何方法步骤的程序代码310的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码510可以例如以适当形式进行压缩。
综上所述,本申请实施例提供的分流方法、装置、服务器以及存储介质,获取当前分流信息,其中,当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数,对每个实验版本对应的预设分流比例和每个实验版本对应的已分流次数进行计算,获得每个实验版本对应的分流优先系数,基于每个实验版本对应的分流优先系数,从多个实验版本中确定目标实验版本,向目标实验版本引流,从而通过对各个实验版本对应的预设分流比例和已分流次数进行计算,获得各个实验版本对应的分流优先系数,并根据分流优先系数确定目标实验版本进行引流,使流量可以无差别的贴近预设的分流比例,被分配到各个实验版本中。
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (20)

  1. 一种分流方法,其特征在于,所述方法包括:
    获取当前分流信息,其中,所述当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数;
    对所述每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数进行计算,获得所述每个实验版本对应的分流优先系数;
    基于所述每个实验版本对应的分流优先系数,从所述多个实验版本中确定目标实验版本;
    向所述目标实验版本引流。
  2. 根据权利要求1所述的方法,其特征在于,所述基于所述每个实验版本对应的分流优先系数,从所述多个实验版本中确定目标实验版本,包括:
    基于所述每个实验版本对应的分流优先系数,获取所述每个实验版本对应的预设分流比例和当前分流比例之间的差值;
    基于所述每个实验版本对应的预设分流比例和当前分流比例之间的差值,从所述多个实验版本中确定目标实验版本。
  3. 根据权利要求1或2所述的方法,其特征在于,所述基于所述每个实验版本对应的分流优先系数,从所述多个实验版本中确定目标实验版本,包括:
    基于所述每个实验版本对应的分流优先系数,对所述多个实验版本进行排序;
    基于所述多个实验版本的排序顺序,从所述多个实验版本中确定目标实验版本。
  4. 根据权利要求3所述的方法,其特征在于,所述基于所述每个实验版本对应的分流优先系数,对所述多个实验版本进行排序,包括:
    基于所述每个实验版本对应的分流优先系数,按分流优先系数从大到小的顺序对所述多个实验版本进行排序。
  5. 根据权利要求4所述的方法,其特征在于,所述基于所述多个实验版本的排序顺序,从所述多个实验版本中确定目标实验版本,包括:
    基于所述多个实验版本的排序顺序,获取排序顺序在首位的实验版本;
    将所述排序顺序在首位的实验版本确定为所述目标实验版本。
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述基于所述每个实验版本对应的分流优先系数,从所述多个实验版本中确定目标实验版本,包括:
    基于所述每个实验版本对应的分流优先系数,从所述多个实验版本中获取分流优先系数最大的实验版本;
    将所述分流优先系数最大的实验版本确定为所述目标实验版本。
  7. 根据权利要求1-6任一项所述的方法,其特征在于,所述方法还包括:
    当所述每个实验版本对应的已分流次数均为零时,基于所述每个实验版本对应的预设分流比例,从所述多个实验版本中确定所述目标实验版本。
  8. 根据权利要求7所述的方法,其特征在于,所述当所述每个实验版本对应的已分流次数均为零时,基于所述每个实验版本对应的预设分流比例,从所述多个实验版本中确定所述目标实验版本,包括:
    当所述每个实验版本对应的已分流次数均为零时,从所述多个实验版本中获取预设分流比例最大的实验版本;
    将所述预设分流比例最大的实验版本确定为所述目标实验版本。
  9. 根据权利要求1-8任一项所述的方法,其特征在于,所述对所述每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数进行计算,获得所述每个实验版本对应的分流优先系数,包括:
    基于
    Figure PCTCN2020087065-appb-100001
    对所述每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数进行计算,获得所述每个实验版本对应的分流优先系数c i,其中,k表 示实验版本的数量,
    Figure PCTCN2020087065-appb-100002
    表示第i个实验版本对应的预设分流比例,n i表示第i个实验版本对应的已分流次数。
  10. 根据权利要求1-9任一项所述的方法,其特征在于,所述向所述目标实验版本引流之后,还包括:
    获取向所述目标实验版本引流的访问流量对应的用户标识信息;
    将所述用户标识信息缓存到Redis中。
  11. 根据权利要求10所述的方法,其特征在于,所述将所述用户标识信息缓存到所述Redis中,包括:
    将所述用户标识信息和所述目标实验版本以键值对的方式缓存到Redis中。
  12. 根据权利要求10或11所述的方法,其特征在于,所述将所述用户标识信息缓存到Redis中之后,还包括:
    设置所述用户标识信息的缓存过期时间。
  13. 根据权利要求12所述的方法,其特征在于,所述设置所述用户标识信息的缓存过期时间之后,还包括:
    若在所述缓存过期时间内接收到所述用户标识信息的访问请求时,延迟所述用户标识信息的缓存过期时间;
    若在所述缓存过期时间内没有接收到所述用户标识信息的访问请求时,从Redis中删除所述用户标识信息。
  14. 根据权利要求1-13任一项所述的方法,其特征在于,所述向所述目标实验版本引流之后,还包括:
    获取所述每个实验版本对应的当前已分流次数;
    将所述每个实验版本对应的当前已分流次数缓存到Redis中。
  15. 根据权利要求14所述的方法,其特征在于,所述将所述每个实验版本对应的当前已分流次数缓存到Redis中,包括:
    获取所述每个实验版本对应的版本标识信息;
    将所述每个实验版本对应的版本标识信息和所述每个实验版本对应的当前分流次数以键值对的方式缓存到Redis中。
  16. 根据权利要求14或15所述的方法,其特征在于,所述获取所述每个实验版本对应的当前已分流次数之后,还包括:
    基于所述每个实验版本的当前已分流次数,更新所述当前分流信息。
  17. 根据权利要求1-16任一项所述的方法,其特征在于,所述向所述目标实验版本引流,包括:
    通过Redis中的incr命令向所述目标实验版本引流。
  18. 一种分流装置,其特征在于,所述装置包括:
    当前分流信息获取模块,用于获取当前分流信息,其中,所述当前分流信息包括多个实验版本中的每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数;
    分流优先系数获得模块,用于对所述每个实验版本对应的预设分流比例和所述每个实验版本对应的已分流次数进行计算,获得所述每个实验版本对应的分流优先系数;
    目标实验版本确定模块,用于基于所述每个实验版本对应的分流优先系数,从所述多个实验版本中确定目标实验版本;
    引流模块,用于向所述目标实验版本引流。
  19. 一种服务器,其特征在于,包括存储器和处理器,所述存储器耦接到所述处理器,所述存储器存储指令,当所述指令由所述处理器执行时所述处理器执行如权利要求1-17任一项所述的方法。
  20. 一种计算机可读取存储介质,其特征在于,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行如权利要求1-17任一项所述的方法。
PCT/CN2020/087065 2020-04-26 2020-04-26 分流方法、装置、服务器以及存储介质 WO2021217307A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2020/087065 WO2021217307A1 (zh) 2020-04-26 2020-04-26 分流方法、装置、服务器以及存储介质
CN202080094720.2A CN115023689A (zh) 2020-04-26 2020-04-26 分流方法、装置、服务器以及存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/087065 WO2021217307A1 (zh) 2020-04-26 2020-04-26 分流方法、装置、服务器以及存储介质

Publications (1)

Publication Number Publication Date
WO2021217307A1 true WO2021217307A1 (zh) 2021-11-04

Family

ID=78373226

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/087065 WO2021217307A1 (zh) 2020-04-26 2020-04-26 分流方法、装置、服务器以及存储介质

Country Status (2)

Country Link
CN (1) CN115023689A (zh)
WO (1) WO2021217307A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114942881A (zh) * 2022-05-10 2022-08-26 北京百度网讯科技有限公司 用于a/b测试实验的方法及装置、电子设备和介质
CN115361340A (zh) * 2022-08-24 2022-11-18 深圳依时货拉拉科技有限公司 Ab实验分流方法、装置、计算机设备和存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109308255A (zh) * 2017-07-28 2019-02-05 北京京东尚科信息技术有限公司 一种用于a/b测试实验的方法和装置
CN110019072A (zh) * 2017-11-21 2019-07-16 北京京东尚科信息技术有限公司 基于实时数据的ab实验方法及系统
CN110413533A (zh) * 2019-09-03 2019-11-05 江苏满运软件科技有限公司 Ab测试方法、系统、设备及存储介质
CN110838031A (zh) * 2019-11-11 2020-02-25 深圳乐信软件技术有限公司 一种基于ABtest的数据运营方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109308255A (zh) * 2017-07-28 2019-02-05 北京京东尚科信息技术有限公司 一种用于a/b测试实验的方法和装置
CN110019072A (zh) * 2017-11-21 2019-07-16 北京京东尚科信息技术有限公司 基于实时数据的ab实验方法及系统
CN110413533A (zh) * 2019-09-03 2019-11-05 江苏满运软件科技有限公司 Ab测试方法、系统、设备及存储介质
CN110838031A (zh) * 2019-11-11 2020-02-25 深圳乐信软件技术有限公司 一种基于ABtest的数据运营方法和装置

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114942881A (zh) * 2022-05-10 2022-08-26 北京百度网讯科技有限公司 用于a/b测试实验的方法及装置、电子设备和介质
CN115361340A (zh) * 2022-08-24 2022-11-18 深圳依时货拉拉科技有限公司 Ab实验分流方法、装置、计算机设备和存储介质
CN115361340B (zh) * 2022-08-24 2024-02-27 深圳依时货拉拉科技有限公司 Ab实验分流方法、装置、计算机设备和存储介质

Also Published As

Publication number Publication date
CN115023689A (zh) 2022-09-06

Similar Documents

Publication Publication Date Title
WO2021217307A1 (zh) 分流方法、装置、服务器以及存储介质
US20160117079A1 (en) Method and apparatus for displaying application icons on terminal
US11188462B2 (en) Method, device, and computer program product for managing address mapping in storage system
US20220116471A1 (en) Image transformation in hybrid sourcing architecture
WO2019076113A1 (zh) 一种信息处理方法、装置及设备
WO2022082892A1 (zh) 大数据分析方法、系统、计算机设备及其存储介质
CN110648216A (zh) 一种风控方法和装置
CN107895537B (zh) 一种电子地图的显示方法、相关装置及存储介质
WO2021051879A1 (zh) 反向代理评价模型中目标参数选取方法及相关装置
CN109815241B (zh) 数据查询方法、装置、设备和存储介质
CN109165723B (zh) 用于处理数据的方法和装置
CN113760982B (zh) 一种数据处理方法和装置
KR20210125448A (ko) 데이터 어노테이션 방법, 장치, 전자 설비 및 저장매체
US20200403953A1 (en) Systems and methods for suppressing repetitive notifications about messages in messaging groups
US10878821B2 (en) Distributed system for conversational agent
CN114757214B (zh) 用于优化翻译模型的样本语料的选取方法、相关装置
US20220300573A1 (en) Method for presenting information, electronic device, and storage medium
CN107741970B (zh) 用于对主页面进行布局的方法和装置
US9590933B2 (en) Generation of a communication request based on visual selection
US11621000B2 (en) Systems and methods for associating a voice command with a search image
CN116861397A (zh) 一种请求处理方法、装置、电子设备及计算机可读介质
CN107526530B (zh) 数据处理方法和设备
CN114048797A (zh) 确定地址相似度的方法、装置、介质及电子设备
CN108984426B (zh) 用于处理数据的方法和装置
US20140289336A1 (en) Migrating Social Connections from a First Profile to a Second Profile

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20933044

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 17/03/2023)

122 Ep: pct application non-entry in european phase

Ref document number: 20933044

Country of ref document: EP

Kind code of ref document: A1