CN115190076A - Flow shunting method and device, computer readable storage medium and electronic equipment - Google Patents
Flow shunting method and device, computer readable storage medium and electronic equipment Download PDFInfo
- Publication number
- CN115190076A CN115190076A CN202210827687.0A CN202210827687A CN115190076A CN 115190076 A CN115190076 A CN 115190076A CN 202210827687 A CN202210827687 A CN 202210827687A CN 115190076 A CN115190076 A CN 115190076A
- Authority
- CN
- China
- Prior art keywords
- target
- traffic
- resource management
- container
- application
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 79
- 230000008569 process Effects 0.000 claims abstract description 24
- 238000004364 calculation method Methods 0.000 claims description 40
- 238000012545 processing Methods 0.000 claims description 9
- 238000004590 computer program Methods 0.000 claims description 8
- 238000012360 testing method Methods 0.000 abstract description 22
- 230000008878 coupling Effects 0.000 abstract description 13
- 238000010168 coupling process Methods 0.000 abstract description 13
- 238000005859 coupling reaction Methods 0.000 abstract description 13
- 238000004422 calculation algorithm Methods 0.000 description 12
- 238000010586 diagram Methods 0.000 description 12
- 238000002474 experimental method Methods 0.000 description 9
- 238000011161 development Methods 0.000 description 8
- 230000000694 effects Effects 0.000 description 8
- 230000006870 function Effects 0.000 description 4
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000007423 decrease Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000014509 gene expression Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 210000001503 joint Anatomy 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/12—Avoiding congestion; Recovering from congestion
- H04L47/125—Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3692—Test management for test results analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Stored Programmes (AREA)
Abstract
The invention discloses a flow distribution method, a flow distribution device, a computer readable storage medium and electronic equipment. Relating to the field of cloud computing, the method comprises the following steps: acquiring the flow of at least one target object requesting to access a service application; flow is divided and calculated through a current target container, and the corresponding relation between each target object and each version is determined, wherein the target containers correspond to the application containers one to one, different application containers are used for running different versions of the same service application, and the different application containers are arranged in different resource management components; and routing the traffic corresponding to the at least one target object to the target resource management component based on the corresponding relation. The invention solves the technical problem of high working cost caused by high coupling of related shunting tools and service application in the process of performing AB test in the prior art.
Description
Technical Field
The invention relates to the field of cloud computing, in particular to a flow shunting method and device, a computer readable storage medium and electronic equipment.
Background
With the gradual decline of internet traffic dividend, more and more product operations begin to pay attention to data-driven refined operation methods, and it is expected that the robust user growth is continuously obtained through the refined operation, and the AB test is one of effective refined operation means: before formal iteration release of a product, two or more schemes are made for the same target, user flow is divided into several groups correspondingly, on the premise that the characteristics of each group of users are similar, the users can see different scheme designs respectively, and decision is made scientifically according to real data feedback of several groups of users.
As a basic function of the AB test, the AB test integration capability is provided for application products in the AB test in a shunting manner, and random distribution effects of different users on different experimental schemes are realized for business applications. Based on the result of the shunting, the application product presents different schemes for the user, and provides basic support for the follow-up statistics of the use condition of the user in the product.
However, in the prior art, the code of the related shunting tool is usually introduced into the business application code to realize shunting. For example, as shown in fig. 1, a service party that needs to perform an AB test introduces an SDK (Software Development Kit) into an application product, and the application product obtains AB test information (for example, experiment information/experiment groups) necessary for offloading, which is pre-configured in an infrastructure of an AB test platform, by calling an SDK interface, and when a user initiates an access request, obtains an experiment group allocated by the user in the AB test through the SDK, so as to return a page or data of a corresponding scheme of the corresponding experiment group of the user, thereby implementing an offloading effect of the user. The SDK is provided for an application product needing AB test in a form of a dependency package, the application product is introduced into the SDK to the product code library and is subjected to personalized development, and finally the SDK is constructed as a part of the application product code together with the service code and is released to the running environment to be integrated with the application service system.
Therefore, in the process of implementing AB test shunting, the related method in the prior art needs to introduce an external code (code of the related shunting tool) into the service application code, so that the coupling between the related shunting tool and the service application is too high, thereby increasing the development cost of the service on the one hand, and on the other hand, the external code runs as a part of the service system, and occupies part of resources in the process and even generates an abnormal situation, thereby generating a negative effect, and further causing a problem of high working cost.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a flow shunting method, a flow shunting device, a computer readable storage medium and electronic equipment, which are used for at least solving the technical problem of high working cost caused by high coupling of related shunting tools and service application in the process of performing AB test in the prior art.
According to an aspect of an embodiment of the present invention, there is provided a traffic splitting method, including: acquiring the flow of at least one target object requesting to access a service application; flow is divided and calculated through a current target container, and the corresponding relation between each target object and the version of the business application is determined, wherein the target containers correspond to the application containers one to one, different application containers are used for running different versions of the same business application, and the different application containers are arranged in different resource management components; and routing the flow corresponding to the at least one target object to the target resource management component based on the corresponding relation.
Further, the flow splitting method further comprises: determining a random number corresponding to each target object based on a flow factor corresponding to the flow through the current target container; acquiring the total barrel number of the sub-barrels corresponding to all the versions; performing modulo calculation on the random number and the total barrel number to obtain a calculation result; determining the sub-bucket to which each target object belongs based on the calculation result; and determining the corresponding relation between each target object and the version based on the sub-bucket to which each target object belongs.
Further, the flow splitting method further comprises: if the corresponding relation representation target version is the same as the version corresponding to the current target container, determining that the current resource management component is the target resource management component, and routing the target traffic to the current application container, wherein the target version is the version corresponding to the target traffic, and the target traffic is the traffic in the traffic corresponding to at least one target object; if the corresponding relation representation target version is different from the version corresponding to the current target container, determining the resource management component corresponding to the target version as the target resource management component, and routing the target traffic to the target container in the target resource management component.
Further, the target container in the target resource management component is configured to determine whether a target identifier exists in the target request after routing the target traffic to the target container in the target resource management component, and if the target identifier exists, route the target traffic to the application container in the target resource management component, where the target request is used to request the target resource management component to process the target traffic, and the target identifier indicates that the target traffic has completed the offload computation.
Further, the flow splitting method further comprises: before the flow of at least one target object requesting to access the business application is obtained, constructing a mirror image file corresponding to each version based on different versions of the business application; determining a resource management component for running the image file; the target container is configured in a resource management component for running the image file.
Further, the flow splitting method further comprises: after configuring a target container in a resource management component for running the image file, updating a routing object of a target gateway from a port of an application container to a port of the target container, wherein the target gateway is used for receiving at least one target object requesting to access traffic application traffic.
Further, the flow splitting method further includes: after a target container is configured in a resource management component for running an image file, at least one shunting rule is obtained, wherein the shunting rule is used for determining a method for shunting and calculating flow by the target container; acquiring a host address of a host where each resource management component is located; and generating a target distribution rule based on the distribution rule and the host address, wherein the target distribution rule is used for determining the corresponding relation between the version and the resource management component by the target container.
According to another aspect of the embodiments of the present invention, there is also provided a flow diversion apparatus, including: the acquisition module is used for acquiring the flow of at least one target object requesting to access the service application; the determining module is used for performing flow distribution calculation on the flow through the current target container and determining the corresponding relation between each target object and the version of the business application, wherein the target containers correspond to the application containers one to one, different application containers are used for running different versions of the same business application, and the different application containers are arranged in different resource management components; and the processing module is used for routing the flow corresponding to the at least one target object to the target resource management component based on the corresponding relation.
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, where the computer program is configured to execute the above-mentioned traffic splitting method when running.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including one or more processors; a memory for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement a method for running a program, wherein the program is arranged to perform the above-described traffic splitting method when running.
In the embodiment of the invention, a flow distribution mode is realized based on a target container separated from an application container, the flow of at least one target object requesting to access a service application is obtained, then the flow distribution calculation is carried out through the current target container, the corresponding relation between each target object and the version of the service application is determined, and therefore the flow corresponding to at least one target object is routed to a target resource management component based on the corresponding relation. The target containers correspond to the application containers one to one, different application containers are used for running different versions of the same business application, and different application containers are arranged in different resource management components.
In the process, because the application container is used for running the service application, the traffic is subjected to the shunting calculation based on the target container separated from the application container, and the traffic corresponding to at least one target object is routed to the target resource management component based on the corresponding relationship between the target object and the version determined by the shunting calculation, so that the coupling between a shunting tool and the service application is effectively reduced, and an external code for realizing shunting is prevented from being introduced into a service application code, so that on one hand, the development cost of the service application is reduced, on the other hand, the resource occupation of the service application during running is reduced, and thus, the relatively low-cost traffic shunting is realized. In addition, different application containers are used for running different versions of the business application, and the problem of high code management complexity caused by the fact that different versions need to be supported in the same set of codes simultaneously by adopting the existing related shunting tools when the difference between the different versions is large is solved.
Therefore, the purpose of realizing flow shunting based on the target container separated from the application container is achieved by the scheme provided by the application method, the technical effect of reducing the working cost is achieved, and the technical problem that in the process of performing the AB test in the prior art, the working cost is high due to the fact that the coupling of a related shunting tool and the service application is high is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a schematic diagram of a prior art traffic splitting method;
FIG. 2 is a schematic diagram of an alternative traffic splitting method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an alternative traffic splitting method according to an embodiment of the invention;
fig. 4 is a schematic diagram of an alternative target gateway before a route object update according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating an alternative target gateway after a route object update according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of an alternative traffic splitting method according to an embodiment of the invention;
FIG. 7 is a schematic diagram of an alternative traffic binning algorithm according to embodiments of the present invention;
FIG. 8 is a schematic view of an alternative flow diversion device according to an embodiment of the present invention;
FIG. 9 is a schematic diagram of an alternative electronic device according to embodiments of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of description, some terms or expressions referred to in the embodiments of the present application are explained below:
SDK (Software Development Kit): typically a collection of development tools used by some software engineers to build application software for a specific software package, software framework, hardware platform, operating system, etc., or a kit provided by a third party service provider to implement a certain function of a software product, which is typically presented in the form of API documents, paradigms, tools.
A container: a container is a standardized unit of software that packages code and all its dependencies so that an application runs reliably and quickly from one computing environment to another. The container image is a lightweight, stand-alone executable software package. All that is required when the program runs is included: code, run dependencies, system tools, system libraries, and settings. A container is an abstraction of the application layer that packages code and dependencies together. Multiple containers may run on the same machine and share the operating system kernel with other containers, each running as an independent process in user space.
Kubernetes: kubernetes is a container orchestration engine for Google open sources that supports automated deployment, large-scale scalable, application containerization management. kubernets is a portable, extensible, open-source platform for managing containerized workloads and services that facilitates declarative configuration and automation. kubernets possess a large and rapidly growing ecosystem with a wide range of services, support and tools.
Pod: in a kubernets cluster, pod is the basis for all traffic types, also the minimum unit level for K8S management, the minimum resource management component, which is a combination of one or more containers. These containers share storage, networks, and namespaces, as well as specifications of how to operate. In Pod, all containers are identically arranged and scheduled and run in a shared context. For a particular application, the pods are their logical hosts, which contain multiple application containers related to the service.
Sidecar container (Sidecar container): the Sidecar vessel is a vessel that operates with the main vessel in the Pod. The Sidecar mode can extend and enhance the functionality of the current container without modification. The sidecar may access the same resources as the primary application. The Sidecar is independent of its primary application and is not limited by the primary application development language.
It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for presentation, analyzed data, etc.) referred to in the present disclosure are information and data authorized by the user or sufficiently authorized by each party.
Example 1
In accordance with an embodiment of the present invention, there is provided an embodiment of a traffic splitting method, it should be noted that the steps illustrated in the flowcharts of the figures may be executed in a computer system, such as a set of computer executable instructions, and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be executed in an order different from that described herein.
Fig. 2 is a schematic diagram of an alternative traffic splitting method according to an embodiment of the present invention, and as shown in fig. 2, the method is applied to an AB test scenario and includes the following steps:
step S201, obtaining a flow of at least one target object requesting to access the service application.
In step S201, a flow of at least one target object requesting to access the service application may be obtained through an electronic device, an application system, a server, and the like. Optionally, the traffic of at least one target object requesting to access the service application may be acquired through a current target container in the traffic offload system.
Step S202, flow is subjected to flow distribution calculation through the current target container, and the corresponding relation between each target object and the version of the business application is determined, wherein the target containers correspond to the application containers one to one, different application containers are used for running different versions of the same business application, and different application containers are arranged in different resource management components.
Optionally, the traffic offload system may include multiple resource management components, as shown in the rightmost block diagram in fig. 3, different resource management components correspond to different versions (e.g., version a and version B in fig. 3) of the same business application, and each resource management component includes an application container and a target container, where the application container is used to run the version of the business application corresponding to the resource management component where the application container is located, and the target container is used to obtain the traffic and perform offload computation on the traffic. The resource management component may be a Pod in a Kubernetes system, the target container may be a Sidecar container, and the foregoing different versions of the same service application are used to implement AB testing on the service application.
Optionally, the current target container is a target container in a certain resource management component in the traffic offload system, and in the application, the working process of the target container in each resource management component is exemplified by the working process of the current target container. Specifically, when the current target container obtains a flow rate of at least one target object requesting to access the service application, the current target container may determine a method for performing a flow splitting calculation on the flow rate based on pre-pulled flow splitting configuration information, where the method for performing the flow splitting calculation on the flow rate may be used to determine a ratio of the flow rate corresponding to each version to the total flow rate, an adopted flow splitting algorithm, and the like, so that a correspondence between each target object and the version of the service application may be determined based on a result of the flow splitting calculation.
It should be noted that, since the application container is used to run the service application, the flow is shunted and calculated based on the target container separated from the application container, so that the coupling between the shunting tool and the service application is effectively reduced, and the introduction of an external code for realizing shunting into a service application code is avoided, so that on one hand, the development cost of the service application is reduced, and on the other hand, the resource occupation during the running of the service application is reduced. In addition, different application containers are used for running different versions of the service application, so that the problem of high code management complexity caused by the fact that different versions need to be supported in the same set of codes simultaneously by using the SDK when the difference between the different versions is large is solved.
Step S203, based on the corresponding relationship, routing the traffic corresponding to the at least one target object to the target resource management component.
Optionally, after determining the correspondence between each target object and the version, the current target container may use a resource management component corresponding to the version corresponding to the traffic of at least one target object as a target resource management component, route the traffic corresponding to the at least one target object to a target container in the target resource management component in an agent manner, and then route the traffic to an application container in the target resource management component through the target container in the target resource management component, so as to perform an AB test. The current target container may determine a corresponding relationship between each version and the resource management component based on the foregoing offloading configuration information.
Based on the solutions defined in steps S201 to S203, it can be known that, in the embodiment of the present invention, a traffic splitting manner is implemented based on a target container separated from an application container, a traffic of a service application requested to be accessed by at least one target object is obtained, then, a splitting calculation is performed on the traffic through a current target container, a correspondence between each target object and a version of the service application is determined, and thus, based on the correspondence, the traffic corresponding to at least one target object is routed to a target resource management component. The target containers correspond to the application containers one to one, different application containers are used for running different versions of the same business application, and different application containers are arranged in different resource management components.
It is easily noted that, in the above process, since the application container is used to run the service application, the traffic is shunted and calculated based on the target container separated from the application container, and the traffic corresponding to at least one target object is routed to the target resource management component based on the correspondence between the target object and the version determined by the shunting calculation, so that the coupling between the shunting tool and the service application is effectively reduced, and the introduction of an external code for implementing shunting into a service application code is avoided, so that on one hand, the development cost of the service application is reduced, on the other hand, the resource occupation during the operation of the service application is reduced, and thus, the relatively low-cost traffic shunting is implemented. In addition, different application containers are used for running different versions of the business application, and the problem of high code management complexity caused by the fact that different versions need to be supported in the same set of codes simultaneously by adopting the existing related shunting tools when the difference between the different versions is large is solved.
Therefore, the purpose of realizing flow shunting based on the target container separated from the application container is achieved by the scheme provided by the application method, the technical effect of reducing the working cost is achieved, and the technical problem that in the process of performing the AB test in the prior art, the working cost is high due to the fact that the coupling of a related shunting tool and the service application is high is solved.
In an alternative embodiment, before obtaining the traffic of at least one target object requesting to access the business application, the traffic offload system may construct an image file corresponding to each version based on different versions of the business application, and then determine a resource management component for running the image file, so as to configure a target container in the resource management component for running the image file.
Optionally, as shown in fig. 3, related staff may develop each version in the AB test, and construct a mirror image file corresponding to the version of the developed service application by the traffic offload system based on the version of the service application, and then the traffic offload system may determine the Pod to which each mirror image is allocated, configure target containers for the pods, and finally deploy and run application containers and target containers corresponding to the versions in each Pod.
It should be noted that, by configuring the target container in the resource management component for running the image file, external code for implementing offloading is prevented from being introduced into the business application code, and coupling between the offloading tool and the business application is effectively reduced.
In an alternative embodiment, after configuring the target container in the resource management component for running the image file, the traffic offload system may update the routing object of the target gateway from the port of the application container to the port of the target container, where the target gateway is configured to receive traffic for which at least one target object requests access to the service application.
Optionally, as shown in fig. 4 and fig. 5, in an actual application scenario, traffic of a user (i.e., the aforementioned target object) enters the service application through the target gateway, and the target gateway randomly distributes the traffic to a certain Pod. Therefore, after the target container is configured, in order to ensure that the target container can achieve the acquisition and offloading computation of traffic, it is necessary to update the routing object of the target gateway from the port of the application container shown in fig. 4 (i.e., "application container: 80" in fig. 4) to the port of the target container shown in fig. 5 (i.e., "target container: 80" in fig. 5) based on port replacement in a traffic hijacking manner, i.e., the port exposed outside the original service application is taken over by the target container, so that the target container can implement traffic proxy. Wherein the configuration of the target gateway may remain unchanged.
It should be noted that, by replacing the routing object of the target gateway, effective implementation of the offload computation is ensured.
In an alternative embodiment, after configuring the target container in the resource management component for running the image file, the traffic offload system may obtain at least one offload rule, and then obtain a host address of a host where each resource management component is located, so as to generate the target offload rule based on the offload rule and the host address. The flow distribution rule is used for determining a method for the target container to perform flow distribution calculation, and the target flow distribution rule is at least used for determining the corresponding relation between the version and the resource management component of the target container.
Optionally, after configuring the target container, as shown in fig. 3, the relevant staff may define the AB test to obtain experimental information (i.e., a diversion rule), and configure the experimental information to an experimental diversion service in the flow diversion system. The method for performing the flow splitting calculation on the flow can be used for determining the proportion of the flow corresponding to each version to the total flow, the adopted splitting algorithm and the like.
Further, as shown in fig. 3, the experimental offloading service in the traffic offloading system may also be interfaced with a service registration center in the traffic offloading system, and optionally, a working process of the registration center is described first. Specifically, as shown in fig. 3, the service application is deployed through micro-services, and after the application container in the Pod and the target container run, each container may register its own service information (e.g., port address, etc.) to the service registry. All container copies providing the same service function need to be regarded as the same service, that is, pod corresponding to the same version is regarded as the same service. Therefore, it is necessary to uniformly manage information such as service information and a running copy address (i.e., the aforementioned host address) of each service through a centralized service registry. It should be noted that, in order to ensure the processing efficiency of the traffic offload system on the user traffic, corresponding sets of Pod may be set for the same version of the same service application.
Further, as shown in fig. 3, the experiment offloading service may pull the service information and the running copy address of each Pod from the service registration center, and finally calculate and form offloading configuration information (i.e., the target offloading rule) required by the target container in combination with the experiment information, so that the target container may successfully route the traffic corresponding to the version corresponding to each Pod to the Pod based on information such as the running copy address of each Pod. The target container may obtain the offloading configuration information from the experiment offloading service through a network request of a fixed protocol in a timing pulling manner.
It should be noted that, by determining the target offload rule based on the offload rule and the host address of the host where each resource management component is located, it is ensured that the target container in each resource management component can successfully route each traffic to the corresponding resource management component in the application process.
In an optional embodiment, in the process of performing flow distribution calculation on traffic through a current target container and determining a corresponding relationship between each target object and a version of a service application, a traffic distribution system may determine, through the current target container, a random number corresponding to each target object based on a traffic factor corresponding to the traffic, then obtain a total bucket number of buckets corresponding to all versions, then perform modulo calculation on the random number and the total bucket number to obtain a calculation result, thereby determining, based on the calculation result, a bucket to which each target object belongs, and then determining, based on the bucket to which each target object belongs, a corresponding relationship between each target object and a version.
Optionally, as shown in fig. 6, the current target container includes a diversion algorithm executor. The current target container can realize a shunting algorithm executor through a flow bucket algorithm. As shown in fig. 6 and 7, in the stage of configuring the experiment information and applying the operation, the experiment offloading service may randomly allocate buckets to each version (i.e., determine the corresponding relationship between each bucket and the version) to obtain a bucket dividing result, and use the bucket dividing result as a part of the offloading configuration information, so that the current target container is pulled and cached locally through the offloading configuration information in the starting stage.
Further, when the traffic of the user requesting to access the service application comes, as shown in fig. 7, the current target container may obtain a random number corresponding to each user through a Hash (Hash) algorithm by calculating according to a traffic factor carried by each traffic, and perform a modulo calculation on the obtained random number and the total bucket number to obtain a calculation result, and use the calculation result as a sub-bucket number of a sub-bucket to which the user belongs, so that the sub-bucket to which each user belongs may be determined based on the calculation result. Then, the version corresponding to each user can be determined according to the bucket dividing result.
Furthermore, because there may be multiple types of pages in the same business application, such as payment pages, advertisement pages, etc., where the different types of pages may correspond to multiple versions, and it may be determined that multiple versions corresponding to the same type of page belong to the same experimental layer and correspond to the same experimental layering number, and the different types of pages belong to different experimental layers, that is, the number of experimental layers of the same business application is equal to the number of page types thereof. Therefore, as shown in fig. 7, when the traffic of the user requesting to access the service application comes, the current target container may obtain, through a Hash (Hash) algorithm, a random number corresponding to each experimental layer and each user according to the traffic factor and the experimental layer number carried by each traffic, so as to determine the correspondence between the user and different versions in each page type.
Still further, for the aforementioned situation that multiple types of pages correspond to multiple versions in the same service application, a combination situation that may occur in the versions corresponding to the various types of pages may be determined based on a permutation and combination manner, and each combination situation is regarded as one version of the service application, that is, multiple Pod are adopted to respectively operate the aforementioned different combination situations, and each Pod operates one combination situation, so as to facilitate subsequent proxy traffic.
It should be noted that, by determining the correspondence between each target object and the version of the service application based on the traffic bucket-dividing algorithm, the traffic of the target object is effectively distributed, and the test effect of the AB test is improved.
In an optional embodiment, in the process of routing traffic corresponding to at least one target object to a target resource management component based on a correspondence relationship, if a correspondence relationship represents that a target version is the same as a version corresponding to a current target container, the traffic offload system may determine that the current resource management component is the target resource management component and route the target traffic to a current application container, and if the correspondence relationship represents that a target version is different from a version corresponding to the current target container, the traffic offload system may determine that a resource management component corresponding to the target version is the target resource management component and route the target traffic to a target container in the target resource management component. The target version is a version corresponding to the target flow, and the target flow is the flow in the flow corresponding to the at least one target object.
Optionally, after the offload algorithm executor in the current application container determines the correspondence between each user and the version, as shown in fig. 6, the offload algorithm executor may perform distribution proxy on the traffic through a traffic proxy router in the current application container.
Specifically, as shown in fig. 6, if a version (i.e., the aforementioned target version) corresponding to a traffic (i.e., the aforementioned target traffic) of a certain user is the same as a version corresponding to a Pod where the current application container is located, the traffic proxy router may directly route the traffic to the application container (i.e., the aforementioned current application container) in the Pod where the current application container is located in a proxy manner. If the version corresponding to the traffic of a certain user is different from the version corresponding to the Pod where the current application container is located, the traffic proxy router may route the traffic to a target container in the Pod with the same version corresponding to the traffic in a proxy manner.
Since the containers in the same Pod share the network and the storage, and expose the same network address to the outside, as shown in fig. 6, for the service container and the application container in the same Pod, the two can perform network mutual access through the local host, and the two externally present the same network address.
It should be noted that, by routing the traffic of the target object to the target container or the application container according to the difference of the target resource management components, the problem of missing supervision caused by routing the traffic to the application container in the process of routing the traffic between different pods is avoided.
In an optional embodiment, the target container in the target resource management component is configured to determine whether a target identifier exists in the target request after routing the target traffic to the target container in the target resource management component, and if the target identifier exists, route the target traffic to the application container in the target resource management component, where the target request is used to request the target resource management component to process the target traffic, and the target identifier indicates that the target traffic has completed the offload computation.
Optionally, when the version corresponding to the traffic of a certain user is different from the version corresponding to the Pod where the current application container is located, and the traffic proxy router in the current application container routes the traffic to the target container in the Pod where the version corresponding to the traffic is the same, the target container in charge of receiving the traffic (i.e., the target container in the target resource management component) may determine whether the request (i.e., the target request) where the traffic is located carries the target identifier, and if the target identifier exists, the target container in charge of receiving the traffic may route the target traffic to the application container in the Pod where the target container in charge of receiving the traffic is located. Otherwise, if the target identifier does not exist, the target container responsible for receiving the flow performs the shunting calculation on the flow.
Further, after the target container responsible for receiving the traffic determines that the target identifier exists, the target container responsible for receiving the traffic may also determine whether the version recorded in the target identifier is the same as the version corresponding to the target container, so as to achieve the monitoring effect. If not, the flow distribution calculation can be carried out again or an error can be reported. The target identifier may also represent a target version corresponding to the target traffic.
It should be noted that, when the target identifier exists in the target request, the target traffic is routed to the application container in the target resource management component, so that the traffic received by the target container from the gateway is effectively distinguished from the traffic received from other Pod, and the accuracy of traffic diversion is further ensured.
In an alternative embodiment, the working process of the target container in the application scenario is described based on the traffic splitting method as shown in fig. 6. Specifically, after user traffic enters service application through a gateway, the traffic is randomly distributed to a Pod by the gateway, a target container is used as a Pod network inlet to acquire the traffic, and flow distribution calculation is executed by a flow distribution algorithm executor according to flow factors (generally user numbers and the like) carried by the traffic to obtain a version corresponding to a user; and if the version corresponding to the user corresponds to other Pod, proxying the flow to the corresponding Pod, thereby realizing flow distribution.
Based on the above, in the present application, the user traffic is proxied to the application containers corresponding to different versions by a traffic proxy request method. Before that, the target container mirror image is only needed to be added into the application deployment strategy, and the work of configuration of a small number of ports and the like is assisted, and the butt joint transformation of business application codes is not needed, so that the work of introducing extra dependence into the application and performing access development can be avoided. Meanwhile, the fact that no extra dependence exists also means that the operation of the business application cannot be affected negatively. In addition, different application containers are used for running different versions of the service application, so that the problem of high code management complexity caused by the fact that different versions need to be supported in the same set of codes simultaneously by using the SDK when the difference between the different versions is large is solved.
Therefore, the purpose of realizing flow shunting based on the target container separated from the application container is achieved by the scheme provided by the application method, the technical effect of reducing the working cost is achieved, and the technical problem that in the process of performing the AB test in the prior art, the working cost is high due to the fact that the coupling of a related shunting tool and the service application is high is solved.
Example 2
According to an embodiment of the present invention, an embodiment of a flow diversion apparatus is provided, where fig. 8 is a schematic diagram of an alternative flow diversion apparatus according to an embodiment of the present invention, as shown in fig. 8, the apparatus includes:
an obtaining module 801, configured to obtain a traffic of at least one target object requesting to access a service application;
a determining module 802, configured to perform flow splitting calculation on a current target container, and determine a correspondence between each target object and a version of a service application, where the target containers correspond to application containers one to one, different application containers are used to run different versions of the same service application, and different application containers are set in different resource management components;
and the processing module 803 is configured to route traffic corresponding to the at least one target object to the target resource management component based on the correspondence.
It should be noted that the acquiring module 801, the determining module 802, and the processing module 803 correspond to steps S201 to S203 in the above embodiment, and the three modules are the same as the corresponding steps in the implementation example and application scenario, but are not limited to the disclosure in embodiment 1.
Optionally, the determining module further includes: the first determining submodule is used for determining a random number corresponding to each target object through the current target container based on the flow factor corresponding to the flow; the first obtaining submodule is used for obtaining the total barrel number of the sub-barrels corresponding to all the versions; the calculation module is used for carrying out modulus calculation on the random number and the total barrel number to obtain a calculation result; the second determining submodule is used for determining the sub-bucket to which each target object belongs based on the calculation result; and the third determining submodule is used for determining the corresponding relation between each target object and the version based on the sub-bucket to which each target object belongs.
Optionally, the processing module further includes: the first processing submodule is used for determining that the current resource management component is the target resource management component and routing target traffic to the current application container if the corresponding relation representation target version is the same as the version corresponding to the current target container, wherein the target version is the version corresponding to the target traffic, and the target traffic is the traffic in the traffic corresponding to at least one target object; and the second processing submodule is used for determining the resource management component corresponding to the target version as the target resource management component and routing the target traffic to the target container in the target resource management component if the corresponding relation representation target version is different from the version corresponding to the current target container.
Optionally, the target container in the target resource management component is configured to determine whether a target identifier exists in the target request after routing the target traffic to the target container in the target resource management component, and if the target identifier exists, route the target traffic to the application container in the target resource management component, where the target request is used to request the target resource management component to process the target traffic, and the target identifier indicates that the target traffic has completed the split computation.
Optionally, the flow splitting device further includes: the construction module is used for constructing a mirror image file corresponding to each version based on different versions of the business application; the fourth determining submodule is used for determining a resource management component for operating the mirror image file; and the configuration module is used for configuring the target container in the resource management component for running the image file.
Optionally, the flow splitting device further includes: and the updating module is used for updating the routing object of the target gateway from the port of the application container to the port of the target container, wherein the target gateway is used for receiving the flow of at least one target object requesting to access the service application.
Optionally, the flow splitting device further includes: the second obtaining submodule is used for obtaining at least one shunting rule, wherein the shunting rule is used for determining a method for carrying out shunting calculation on the flow by a target container; the third acquisition submodule is used for acquiring the host address of the host where each resource management component is located; and the generating module is used for generating a target distribution rule based on the distribution rule and the host address, wherein the target distribution rule is used for determining the corresponding relation between the version and the resource management component by the target container.
Example 3
According to another aspect of the embodiments of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, where the computer program is configured to execute the above-mentioned traffic flow splitting method when the computer program is executed.
Example 4
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, where fig. 9 is a schematic diagram of an alternative electronic device according to the embodiments of the present invention, and as shown in fig. 9, the electronic device includes one or more processors; a memory for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement a method for running a program, wherein the program is arranged to perform the above-described traffic splitting method when running.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, a division of a unit may be a division of a logic function, and an actual implementation may have another division, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or may not be executed. In addition, the shown or discussed coupling or direct coupling or communication connection between each other may be an indirect coupling or communication connection through some interfaces, units or modules, and may be electrical or in other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention, which is substantially or partly contributed by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that it is obvious to those skilled in the art that various modifications and improvements can be made without departing from the principle of the present invention, and these modifications and improvements should also be considered as the protection scope of the present invention.
Claims (10)
1. A method for splitting traffic, comprising:
acquiring the flow of at least one target object requesting to access a service application;
performing flow distribution calculation on the flow through a current target container, and determining the corresponding relation between each target object and the version of the service application, wherein the target containers correspond to the application containers one to one, different application containers are used for running different versions of the same service application, and the different application containers are arranged in different resource management components;
and routing the traffic corresponding to the at least one target object to a target resource management component based on the corresponding relation.
2. The method of claim 1, wherein performing a flow splitting calculation on the traffic through a current target container, and determining a correspondence between each target object and a version of the business application comprises:
determining a random number corresponding to each target object based on a flow factor corresponding to the flow through the current target container;
acquiring the total barrel number of the sub-barrels corresponding to all the versions;
performing modular calculation on the random number and the total barrel number to obtain a calculation result;
determining a sub-bucket to which each target object belongs based on the calculation result;
and determining the corresponding relation between each target object and the version based on the sub-bucket to which each target object belongs.
3. The method of claim 1, wherein routing traffic corresponding to the at least one target object to a target resource management component based on the correspondence comprises:
if the corresponding relation representation target version is the same as the version corresponding to the current target container, determining that the current resource management component is the target resource management component, and routing target traffic to the current application container, wherein the target version is the version corresponding to the target traffic, and the target traffic is traffic in the traffic corresponding to the at least one target object;
if the corresponding relation represents that the target version is different from the version corresponding to the current target container, determining that the resource management component corresponding to the target version is the target resource management component, and routing the target traffic to the target container in the target resource management component.
4. The method of claim 3,
and the target container in the target resource management component is used for determining whether a target identifier exists in a target request after the target traffic is routed to the target container in the target resource management component, and if the target identifier exists, routing the target traffic to an application container in the target resource management component, wherein the target request is used for requesting the target resource management component to process the target traffic, and the target identifier represents that the target traffic has completed shunt calculation.
5. The method of claim 1, wherein prior to obtaining traffic for at least one target object requesting access to a business application, the method further comprises:
constructing a mirror image file corresponding to each version based on different versions of the service application;
determining a resource management component for running the image file;
configuring the target container in a resource management component for running the image file.
6. The method of claim 5, wherein after configuring the target container in a resource management component for running the image file, the method further comprises:
and updating the routing object of the target gateway from the port of the application container to the port of the target container, wherein the target gateway is used for receiving the traffic of the at least one target object requesting to access the service application.
7. The method of claim 5, wherein after configuring the target container in a resource management component for running the image file, the method further comprises:
obtaining at least one shunting rule, wherein the shunting rule is used for determining a method for shunting calculation on the flow by the target container;
acquiring a host address of a host where each resource management component is located;
and generating a target distribution rule based on the distribution rule and the host address, wherein the target distribution rule is at least used for the target container to determine the corresponding relation between the version and the resource management component.
8. A flow diversion apparatus, comprising:
the acquisition module is used for acquiring the flow of at least one target object requesting to access the service application;
the determining module is used for performing flow distribution calculation on the flow through a current target container and determining the corresponding relation between each target object and the version of the business application, wherein the target containers correspond to the application containers one to one, different application containers are used for running different versions of the same business application, and the different application containers are arranged in different resource management components;
and the processing module is used for routing the flow corresponding to the at least one target object to the target resource management component based on the corresponding relation.
9. A computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the traffic splitting method according to any one of claims 1 to 7 when the computer program is executed.
10. An electronic device, characterized in that the electronic device comprises one or more processors; memory for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement a method for running a program, wherein the program is arranged to, when running, perform the traffic offload method of any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210827687.0A CN115190076A (en) | 2022-07-14 | 2022-07-14 | Flow shunting method and device, computer readable storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210827687.0A CN115190076A (en) | 2022-07-14 | 2022-07-14 | Flow shunting method and device, computer readable storage medium and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115190076A true CN115190076A (en) | 2022-10-14 |
Family
ID=83518526
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210827687.0A Pending CN115190076A (en) | 2022-07-14 | 2022-07-14 | Flow shunting method and device, computer readable storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115190076A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110750436A (en) * | 2018-07-23 | 2020-02-04 | 腾讯科技(深圳)有限公司 | Layered testing method and device, computer readable medium and electronic equipment |
CN111338607A (en) * | 2020-02-28 | 2020-06-26 | 北京奇艺世纪科技有限公司 | Method and device for selecting service data for testing and electronic equipment |
CN112929230A (en) * | 2021-01-22 | 2021-06-08 | 中信银行股份有限公司 | Test processing method and device, electronic equipment and computer readable storage medium |
CN113342468A (en) * | 2021-06-23 | 2021-09-03 | 山石网科通信技术股份有限公司 | Container data processing method and device |
CN114422440A (en) * | 2022-03-28 | 2022-04-29 | 北京沃丰时代数据科技有限公司 | Gray scale distribution method and device, electronic equipment and storage medium |
-
2022
- 2022-07-14 CN CN202210827687.0A patent/CN115190076A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110750436A (en) * | 2018-07-23 | 2020-02-04 | 腾讯科技(深圳)有限公司 | Layered testing method and device, computer readable medium and electronic equipment |
CN111338607A (en) * | 2020-02-28 | 2020-06-26 | 北京奇艺世纪科技有限公司 | Method and device for selecting service data for testing and electronic equipment |
CN112929230A (en) * | 2021-01-22 | 2021-06-08 | 中信银行股份有限公司 | Test processing method and device, electronic equipment and computer readable storage medium |
CN113342468A (en) * | 2021-06-23 | 2021-09-03 | 山石网科通信技术股份有限公司 | Container data processing method and device |
CN114422440A (en) * | 2022-03-28 | 2022-04-29 | 北京沃丰时代数据科技有限公司 | Gray scale distribution method and device, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP7203444B2 (en) | Selectively provide mutual transport layer security using alternate server names | |
US10120725B2 (en) | Establishing an initial configuration of a hardware inventory | |
EP3455728B1 (en) | Orchestrator for a virtual network platform as a service (vnpaas) | |
AU2014304231B2 (en) | Managing a succession of deployments of an application programming interface (API) server configuration in the software lifecycle development | |
WO2019204355A1 (en) | Training machine learning models in distributed computing systems | |
US10212050B2 (en) | Providing recursively-generated instantiated computing resource in a multi-tenant environment | |
Bernardos et al. | 5GEx: realising a Europe‐wide multi‐domain framework for software‐defined infrastructures | |
US20120159423A1 (en) | Tenant independent add-on software packages for an enterprise platform as a service product | |
US20200186442A1 (en) | Derivation of network service descriptor from network service requirements | |
EP2815346A1 (en) | Coordination of processes in cloud computing environments | |
Sonkoly et al. | Scalable edge cloud platforms for IoT services | |
WO2015034485A1 (en) | Providing services as resources for other services | |
US11356420B2 (en) | Internet of things (IoT) gateway flow engine optimizer and configuration distribution | |
US11729026B2 (en) | Customer activation on edge computing environment | |
CN114461303A (en) | Method and device for accessing cluster internal service | |
CN118012622A (en) | Heterogeneous cloud-based resource arrangement method, device and medium | |
US11394750B1 (en) | System and method for generating network security policies in a distributed computation system utilizing containers | |
US9323509B2 (en) | Method and system for automated process distribution | |
CN115190076A (en) | Flow shunting method and device, computer readable storage medium and electronic equipment | |
US10193998B2 (en) | Communication apparatus, communication system, and circuit configuration control method | |
Alwakeel et al. | A pattern for NFV management and orchestration (MANO) | |
EP3704894B1 (en) | A method and arrangement for allocating communication resources in a communication network | |
KR102216746B1 (en) | virtual machine placement method in a virtual machine based service function chaining | |
CN115037617B (en) | Optimization method and device for dubbo service treatment | |
WO2020201808A1 (en) | Multi-domain orchestration |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |