CN118295689A - Service issuing method, device, electronic equipment and storage medium - Google Patents

Service issuing method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN118295689A
CN118295689A CN202410460046.5A CN202410460046A CN118295689A CN 118295689 A CN118295689 A CN 118295689A CN 202410460046 A CN202410460046 A CN 202410460046A CN 118295689 A CN118295689 A CN 118295689A
Authority
CN
China
Prior art keywords
service
environment
flow
traffic
tested
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
Application number
CN202410460046.5A
Other languages
Chinese (zh)
Inventor
何建锋
田向阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
OP Retail Suzhou Technology Co Ltd
Original Assignee
OP Retail Suzhou Technology Co Ltd
Filing date
Publication date
Application filed by OP Retail Suzhou Technology Co Ltd filed Critical OP Retail Suzhou Technology Co Ltd
Publication of CN118295689A publication Critical patent/CN118295689A/en
Pending legal-status Critical Current

Links

Abstract

The embodiment of the disclosure provides a service release method, a device, electronic equipment and a storage medium. The service release method comprises the following steps: isolating a first environment and a second environment in which a service to be tested and a first formal service are respectively located by adopting a naming space; forwarding a first flow with a first flow identifier in all flows to the first environment, and processing the first flow by the service to be tested so as to test the service to be tested; forwarding a second flow with a second flow identifier in all flows to the second environment, and processing the second flow by the first formal service; and adjusting the service to be tested based on the test result of the service to be tested.

Description

Service issuing method, device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a service publishing method, device, electronic apparatus, and storage medium.
Background
In the service release process, after the verification of the test environment is passed, the software service can send all functions to the production environment server, and then the test group tests the functions and performance. In the test stage, all users are already adapted with new functions, and if the new version has the problems of functions and performances, the problems are easily caused to the users, so that the normal use of the users is influenced.
In the related art, the switching between the test service and the production service is single, and the use of the user is affected when the test service and the production service are switched, so that the user experience is affected. Therefore, how to flexibly switch test services and production services, while reducing the influence on users, and to realize flexible and stable switching of services between test environments and production environments is a problem to be solved.
Disclosure of Invention
The embodiment of the disclosure provides a service release method, a device, electronic equipment and a storage medium.
According to a first aspect of an embodiment of the present disclosure, a service publishing method is provided, including:
Isolating a first environment and a second environment in which a service to be tested and a first formal service are respectively located by adopting a naming space;
forwarding a first flow with a first flow identifier in all flows to the first environment, and processing the first flow by the service to be tested so as to test the service to be tested;
Forwarding a second flow with a second flow identifier in all flows to the second environment, and processing the second flow by the first formal service;
And adjusting the service to be tested based on the test result of the service to be tested.
According to a first aspect, in some embodiments, the forwarding a first traffic having a first traffic identification of all traffic to the first environment includes:
determining, by a first agent, a traffic identification of a traffic accessing the first agent from among the all traffic;
Forwarding, by the first agent, the first traffic with the first traffic identification to the first environment.
According to a first aspect, in some embodiments, the forwarding the second traffic having the second traffic identification of all traffic to the second environment includes:
Forwarding, by the first agent, the second traffic having the second traffic identification to the second environment.
According to a first aspect, in some embodiments, the method further comprises:
and forwarding a third flow which accesses the second agent in all the flows to the first environment by adopting the second agent, and processing the third flow by the service to be tested so as to test the service to be tested.
According to a first aspect, in some embodiments, the adjusting the service to be tested based on the test result of the service to be tested includes:
Determining the test result as a first result, and determining the service to be tested as a second formal service;
updating the first formal service with the second formal service in the second environment;
And setting the flow marks of all flows as the second flow mark.
According to a first aspect, in some embodiments, the method further comprises:
And determining the test result as a second result, and sending first indication information, wherein the first indication information is used for indicating to adjust the flow identifier of the first flow to a second flow identifier.
According to a first aspect, in some embodiments, the method further comprises:
and determining the test result as a second result, and setting the flow identifier of the first flow as the second flow identifier.
According to a first aspect, in some embodiments, the method further comprises:
Determining that the second formal service in the second environment is abnormal, rolling back the service of the first environment to the first formal service, and forwarding all traffic to the first environment;
And rolling back the second formal service of the second environment to the first formal service, and forwarding all traffic to the second environment.
According to a second aspect of the embodiments of the present disclosure, there is provided a service issuing apparatus, including: a processing module for:
Isolating a first environment and a second environment in which a service to be tested and a first formal service are respectively located by adopting a naming space;
forwarding a first flow with a first flow identifier in all flows to the first environment, and processing the first flow by the service to be tested so as to test the service to be tested;
Forwarding a second flow with a second flow identifier in all flows to the second environment, and processing the second flow by the first formal service;
And adjusting the service to be tested based on the test result of the service to be tested.
According to a second aspect, in some embodiments, the processing module is specifically configured to:
determining, by a first agent, a traffic identification of a traffic accessing the first agent from among the all traffic;
Forwarding, by the first agent, the first traffic with the first traffic identification to the first environment.
According to a second aspect, in some embodiments, the processing module is specifically configured to:
Forwarding, by the first agent, the second traffic having the second traffic identification to the second environment.
According to a second aspect, in some embodiments, the processing module is further to:
and forwarding a third flow which accesses the second agent in all the flows to the first environment by adopting the second agent, and processing the third flow by the service to be tested so as to test the service to be tested.
According to a second aspect, in some embodiments, the processing module is specifically configured to:
Determining the test result as a first result, and determining the service to be tested as a second formal service;
updating the first formal service with the second formal service in the second environment;
And setting the flow marks of all flows as the second flow mark.
According to a second aspect, in some embodiments, the processing module is further to:
and determining the test result as a second result, and setting the flow identifier of the first flow as the second flow identifier.
According to a second aspect, in some embodiments, the processing module is further to:
Determining that the second formal service in the second environment is abnormal, rolling back the service of the first environment to the first formal service, and forwarding all traffic to the first environment;
And rolling back the second formal service of the second environment to the first formal service, and forwarding all traffic to the second environment.
According to a second aspect, in some embodiments, the apparatus further comprises:
and the receiving and transmitting module is used for determining the test result as a second result and transmitting first indication information, wherein the first indication information is used for indicating to adjust the flow identifier of the first flow to a second flow identifier.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic device, including:
one or more processors;
Wherein the processor is configured to invoke instructions to cause the electronic device to perform the service delivery method of any of claims 1 to 7.
According to a fourth aspect of the embodiments of the present disclosure, a storage medium is provided, characterized in that the storage medium stores instructions that, when executed on an electronic device, cause the electronic device to perform the service distribution method according to any one of claims 1 to 7.
The service release method according to the embodiment of the disclosure comprises the following steps: isolating a first environment and a second environment in which a service to be tested and a first formal service are respectively located by adopting a naming space; forwarding a first flow with a first flow identifier in all flows to the first environment, and processing the first flow by the service to be tested so as to test the service to be tested; forwarding a second flow with a second flow identifier in all flows to the second environment, and processing the second flow by the first formal service; and adjusting the service to be tested based on the test result of the service to be tested. Therefore, on one hand, the first environment and the second environment are isolated by adopting the naming space, so that the first environment and the second environment are logically isolated, the mutual influence of the two environments is reduced, and the stability is improved. On the other hand, the distribution of the flow between the first environment and the second environment is realized through the flow identification of the flow, and service is not required to be stopped, so that the flexibility of switching the service between the two environments is improved, and the influence on the user is reduced.
Drawings
FIG. 1 is a schematic diagram of an application environment of a service delivery method, shown in accordance with an exemplary embodiment;
FIG. 2 is a flow diagram illustrating a service distribution method according to an example embodiment;
FIG. 3 is a flow diagram illustrating a service distribution method according to an example embodiment;
FIG. 4 is a flow diagram illustrating a service distribution method according to an example embodiment;
FIG. 5 is a schematic diagram of an application environment of a service distribution method, according to an example embodiment;
FIG. 6 is a flow diagram illustrating a service distribution method according to an example embodiment;
FIG. 7 is a flow diagram illustrating a service distribution method according to an example embodiment;
FIG. 8 is a schematic diagram of an application environment of a service distribution method, according to an example embodiment;
FIG. 9 is a flow diagram illustrating a service distribution method according to an example embodiment;
FIG. 10 is a flow diagram illustrating a service distribution method according to an example embodiment;
FIG. 11 is a flowchart illustrating a service distribution method according to an exemplary embodiment;
FIG. 12 is a flow diagram illustrating a service distribution method according to an example embodiment;
fig. 13 is a schematic structural view of a service issuing apparatus according to an exemplary embodiment;
fig. 14 is a schematic diagram showing a structure of an electronic device according to an exemplary embodiment.
Detailed Description
In order to make the technical scheme and the beneficial effects of the application more obvious and understandable, the following detailed description is given by way of example. Wherein the drawings are not necessarily to scale, and wherein local features may be exaggerated or reduced to more clearly show details of the local features; unless defined otherwise, technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.
The embodiments of the present disclosure are not intended to be exhaustive, but rather are exemplary of some embodiments and are not intended to limit the scope of the disclosure. In the case of no contradiction, each step in a certain embodiment may be implemented as an independent embodiment, and the steps may be arbitrarily combined, for example, a scheme in which part of the steps are removed in a certain embodiment may also be implemented as an independent embodiment, the order of the steps in a certain embodiment may be arbitrarily exchanged, and further, alternative implementations in a certain embodiment may be arbitrarily combined; furthermore, various embodiments may be arbitrarily combined, for example, some or all steps of different embodiments may be arbitrarily combined, and an embodiment may be arbitrarily combined with alternative implementations of other embodiments.
In the various embodiments of the disclosure, terms and/or descriptions of the various embodiments are consistent throughout the various embodiments and may be referenced to each other in the absence of any particular explanation or logic conflict, and features from different embodiments may be combined to form new embodiments in accordance with their inherent logic relationships.
The terminology used in the embodiments of the disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure.
In the presently disclosed embodiments, elements that are referred to in the singular, such as "a," "an," "the," "said," etc., may mean "one and only one," or "one or more," "at least one," etc., unless otherwise indicated. For example, where an article (article) is used in translation, such as "a," "an," "the," etc., in english, a noun following the article may be understood as a singular expression or as a plural expression.
In the presently disclosed embodiments, "plurality" refers to two or more.
In some embodiments, terms such as "at least one of (at least one of), at least one of (at least one of)", "one or more of", "multiple of", and the like may be substituted for each other.
In some embodiments, "A, B" means at least one of "," a and/or B "," a in one case, B in another case "," a in one case, B "and the like, and may include the following technical solutions according to circumstances: in some embodiments a (a is performed independently of B); b (B is performed independently of a) in some embodiments; in some embodiments, execution is selected from a and B (a and B are selectively executed); in some embodiments a and B (both a and B are performed). Similar to the above when there are more branches such as A, B, C.
In some embodiments, the description modes such as "a or B" may include the following technical schemes according to circumstances: in some embodiments a (a is performed independently of B); b (B is performed independently of a) in some embodiments; in some embodiments execution is selected from a and B (a and B are selectively executed). Similar to the above when there are more branches such as A, B, C.
The prefix words "first", "second", etc. in the embodiments of the present disclosure are only for distinguishing different description objects, and do not limit the location, order, priority, numerical value, content, etc. of the description objects, and the statement of the description object refers to the claims or the description of the embodiment context, and should not constitute unnecessary limitations due to the use of the prefix words. For example, if the description object is a "field", the ordinal words before the "field" in the "first field" and the "second field" do not limit the position or the order between the "fields", and the "first" and the "second" do not limit whether the "fields" modified by the "first" and the "second" are in the same message or not. For another example, describing an object as "level", ordinal words preceding "level" in "first level" and "second level" do not limit priority between "levels". For another example, the numerical value describing the object is not limited by ordinal words, and may be one or more, taking "first device" as an example, where the numerical value of "device" may be one or more. Furthermore, objects modified by different prefix words may be the same or different, e.g., the description object is "a device", then "a first device" and "a second device" may be the same device or different devices, and the types may be the same or different; for another example, the description object is "information", and the "first information" and the "second information" may be the same information or different information, and the contents thereof may be the same or different.
In some embodiments, "comprising a", "containing a", "for indicating a", "carrying a", may be interpreted as carrying a directly, or as indicating a indirectly.
In some embodiments, the terms "… …", "determining … …", "in the case of … …", "at … …", "when … …", "if … …", "if … …", and the like may be interchanged.
In some embodiments, terms "greater than", "greater than or equal to", "not less than", "more than or equal to", "not less than", "above" and the like may be interchanged, and terms "less than", "less than or equal to", "not greater than", "less than or equal to", "not more than", "below", "lower than or equal to", "no higher than", "below" and the like may be interchanged.
In some embodiments, an apparatus or the like may be interpreted as an entity, or may be interpreted as a virtual, and the names thereof are not limited to the names described in the embodiments, "apparatus," "device," "circuit," "network element," "node," "function," "unit," "section," "system," "network," "chip system," "entity," "body," and the like may be replaced with each other.
Furthermore, each element, each row, or each column in the tables of the embodiments of the present disclosure may be implemented as a separate embodiment, and any combination of elements, any rows, or any columns may also be implemented as a separate embodiment.
Fig. 1 is a schematic diagram of an application environment of a service publishing method according to an embodiment of the present disclosure, where the application environment includes at least a server 100 and a terminal 200 as shown in fig. 1.
The server 100 may be used to process traffic transmitted by a user through the terminal 200 through a service (e.g., a software service) running thereon as an environment for a bearer service. The server 100 may also send the service result obtained by processing the traffic to the terminal 200 for presentation to the user. The server 100 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, a content delivery network (Content Delivery Network, abbreviated as CDN), basic cloud computing services such as big data and an artificial intelligent platform.
Terminal 200 may include, but is not limited to, smart phones, desktop computers, tablet computers, notebook computers, smart speakers, digital assistants, smart wearable devices, vehicle terminals, smart televisions, cameras, and passenger flow analyzers; or software running on the electronic device, such as an application, an application program, an applet, etc. Operating systems running on electronic devices in embodiments of the present disclosure may include, but are not limited to, android systems, IOS systems, linux, windows, and the like.
In addition, it should be noted that, the application environment shown in fig. 1 is only an application environment of a data processing method, and in practical application, other application environments may also be included, for example, more terminals may be included.
In the embodiment of the present disclosure, the server 100 and the terminal 200 may be directly or indirectly connected through a wired or wireless communication manner, and the disclosure is not limited herein.
As shown in fig. 2, an embodiment of the present disclosure provides a service publishing method, including:
Step 201: and isolating a first environment and a second environment in which the service to be tested and the first formal service are respectively located by adopting the naming space.
The first formal service and the service to be tested may comprise software services provided on a server. Such as a passenger flow statistics service, an image recognition service, etc. The first formal service may include a formally published service that has completed development and published to all users. The services to be tested may include services for testing that are in the development process, published to some users.
The first environment and the second environment may include running resources of a service, such as servers and the like.
In one possible implementation, the hardware resources of the first environment and the second environment are independent. For example, a first environment contains a different server than a second environment.
In one possible implementation, the first environment may be a test environment of the service. The second environment may be a production environment of the service.
In one possible implementation, the first environment and the second environment employ the same hardware resource. The first environment and the second environment use hardware resources in a time division multiplexed manner. In one possible implementation, the second environment has higher performance than the first environment. The second environment having a higher performance than the first environment includes at least one of: the hardware device processing capacity of the second environment is higher than that of the first environment; the data transmission bandwidth of the second environment is greater than the data transmission bandwidth of the first environment. For example: the second environment has more servers, the computational power of the second environment is higher, and the second environment has larger network access bandwidth.
Here, a namespace (NAME SPACE) may be employed to isolate the first environment from the second environment. So that the first environment and the second environment are logically isolated. Thus, the mutual influence of two environments can be reduced, and the stability is improved.
In practical applications, the isolated first environment and second environment may be registered through nacos.
In one possible implementation, the service to be tested and the first formal service may employ the same database. For example, if the field of the service requirement to be tested and the field of the first formal service requirement are different, the field of the service requirement to be tested and the field of the first formal service requirement may both be placed in the same database. In this way, the processing complexity of using two sets of databases can be reduced.
In one possible implementation, the service to be tested may be a software service modified on the basis of the first formal service. For example, the first formal service may be a currently running, stable version of the software service, with the service to be tested being a new version of the software service that is updated on the basis of the first formal service based on new requirements.
In one possible implementation, the service to be tested may be an entirely new software service developed independent of the first formal service.
Step 202: and forwarding a first flow with a first flow identifier in all flows to the first environment, and processing the first flow by the service to be tested so as to test the service to be tested.
Here, the traffic may include data traffic of a user request service. Such as a data packet requesting a service, a data packet to be processed by a service, etc.
In one possible implementation, the traffic may be sent by an application on the terminal or a web browser or the like.
In one possible implementation, the traffic identification of the traffic (including the first traffic identification and the second traffic identification) may be configured based on one of: the service type of the flow request; the users corresponding to the flow; load conditions of the first environment and/or the second environment, etc.
For example, one or more first users may be selected from among all users to be assigned a first traffic identification. The first user may carry the first traffic identification in the transmitted traffic. I.e. the first traffic sent by the first user. The first user may be a user participating in the software introspection.
In one possible implementation, the traffic identifier of the traffic may be determined by a gateway, a server, or the like, and when the gateway determines that the current traffic is the first traffic with the first traffic identifier, the traffic is sent to the first environment, and the first traffic is processed by the service to be tested. The service to be tested can process the first flow to obtain a processing result.
Here, the first environment does two things: 1 testing the service to be tested and/or 2 the service to be tested normally handles the first traffic (not as a test). The two works can be completely independent, and a processing process of processing the first flow by the service to be tested, a processing result obtained by processing the first flow, and the like can be monitored by a server, so as to obtain a test result of testing the service to be tested. Here, the service function of the service to be tested may be testing, and the service to be tested may generate a test result. The service to be tested can also be tested, and the obtained test result is obtained. The test result can be generated based on the service itself or can be obtained based on the test process of the service, and can be used for judging the capacity of the service to be tested for processing the flow and/or judging the performance of the service to be tested, and the like, so that whether the service to be tested can meet the requirements or not can be determined.
In one possible implementation, the traffic identification may be carried in Cookies. When an application or web browser in the terminal requests a service, the server may determine to forward the traffic to the first environment or the second environment based on the traffic identification in the Cookies.
In some embodiments, as shown in fig. 3, step 202 may include:
Step 2021: determining, by a first agent, a traffic identification of a traffic accessing the first agent from among the all traffic;
Step 2022: forwarding, by the first agent, the first traffic with the first traffic identification to the first environment.
Here, the first agent may be a reverse-proxy for forwarding traffic to the first environment or the second environment. The first agent may receive traffic sent through an application or web browser on the terminal and determine a traffic identification of the traffic. And determining the traffic with the first traffic identifier as first traffic, and forwarding the first traffic to the first environment, namely forwarding the first traffic to the service to be tested for processing.
In practical application, the first proxy may be implemented by using a reverse proxy server such as nginx.
Step 203: forwarding a second flow with a second flow identifier in all flows to the second environment, and processing the second flow by the first formal service.
Similar to step 202, the traffic here may include data traffic of the user requesting the service. Such as a data packet requesting a service, a data packet to be processed by a service, etc.
In one possible implementation, the traffic may be sent by an application on the terminal or a web browser or the like.
In one possible implementation, the traffic identification of the traffic (including the first traffic identification and the second traffic identification) may be configured based on one of: the service type of the flow request; the users corresponding to the flow; load conditions of the first environment and/or the second environment, etc.
For example, one or more second users may be selected from among all users to be assigned a second traffic identification. The second user may carry a second traffic identification in the transmitted traffic. I.e. the second traffic is sent by the second user.
Similar to step 202, the traffic identification of the traffic may be determined by a gateway, a server, etc., and when the gateway determines that the current traffic is a second traffic having a second traffic identification, the traffic is sent to a second environment, and the second traffic is processed by the first formal service.
In one possible implementation, the traffic identification may be carried in Cookies. When an application or web browser in the terminal requests a service, the server may determine to forward the traffic to the first environment or the second environment based on the traffic identification in the Cookies.
In some embodiments, as shown in fig. 4, step 203 may include:
Step 2031: forwarding, by the first agent, the second traffic having the second traffic identification to the second environment.
Fig. 5 is a schematic diagram of an application environment of the service distribution method according to the present embodiment. As shown in fig. 5, the first proxy may be implemented using a reverse proxy server such as nginx. A first environment (namespace) and a second environment (namespace) are established through nacos, isolated by a namespace. The same service in the first environment and the second environment employ the same database (e.g., service 1 in the first environment and service 2 in the second environment employ the same database: service 1 database). The gateways in the first environment and the second environment may select different types of services based on different traffic. The user may send traffic to a first agent (e.g., nginx) using an Application (APP) or network access (WEB), etc.
When a user (including APP and WEB) logs in, the nginx reads the flow identification, if the flow identification is a first flow identification (such as test), the ginx forwards the flow to a first environment (such as a namespace) and if the flow identification is a second flow identification (such as production), the ginx forwards the flow to a second environment (such as a stable).
Step 204: and adjusting the service to be tested based on the test result of the service to be tested.
In one possible implementation, the test results may be determined by a server or the like. For example, the server may record a log of the service processing traffic to be tested, and the log may record the test result.
In one possible implementation, the test results may be user-determined. The user may determine the test result based on the processing result of the service processing flow to be tested, or the like.
Here, adjusting the service to be tested based on the test result of the service to be tested may include at least one of:
if the test result meets the preset condition, the service to be tested can be determined to be a formal service;
If the test result does not meet the predetermined condition, the service to be tested can be modified.
The predetermined conditions may include conditions for the passage of a test, such as the ability of a service to meet functional and/or performance requirements, etc.
Therefore, on one hand, the first environment and the second environment are isolated by adopting the naming space, so that the first environment and the second environment are logically isolated, the mutual influence of the two environments is reduced, and the stability is improved. On the other hand, the distribution of the flow between the first environment and the second environment is realized through the flow identification of the flow, and service is not required to be stopped, so that the flexibility of switching the service between the two environments is improved, and the influence on the user is reduced.
In some embodiments, as shown in fig. 6, step 204 may include:
step 2041: determining the test result as a first result, and determining the service to be tested as a second formal service;
step 2042: updating the first formal service with the second formal service in the second environment;
step 2043: and setting the flow marks of all flows as the second flow mark.
Here, the first result may include a result of the test passing.
If the service to be tested passes the test, the service to be tested can be determined to be a second formal service which can be put into production, the second formal service is deployed into a second environment, all traffic is set as a second traffic identifier, and all traffic is processed by the second formal service.
In one possible implementation, after the second formal service is deployed into the second environment, the second formal service may be tested through all traffic. There may be a difference in the operating conditions of the service to be tested in the first environment and the operating conditions after updating into the second environment, for example, a difference in the operating conditions due to a difference in the traffic load, etc. Therefore, after the second formal service is deployed to the second environment, the second formal service is tested, so that the test of the second formal service in the actual running environment can be realized, and the stability of the second formal service after being put into the formal service is improved.
As shown in fig. 7, an embodiment of the present disclosure provides a service publishing method, including:
Step 701: and forwarding a third flow which accesses the second agent in all the flows to the first environment by adopting the second agent, and processing the third flow by the service to be tested so as to test the service to be tested.
In some embodiments, step 701 may be performed separately.
In some embodiments, step 701 may be implemented in combination with at least one of step 201, step 202, step 203, and step 204.
In particular, the second agent may have a specific domain name, for traffic transmitted to that domain name, which the second agent may forward directly to the first environment, the third traffic being processed by the service to be tested. The processing process of processing the third flow by the server and the like, the processing result obtained by processing the third flow and the like can be monitored to obtain the test result of testing the service to be tested. The test result can be used for judging the capacity and/or performance of the service to be tested for processing the flow, and the like, and further can be used for determining whether the service to be tested can meet the requirements. As described above for the different test results, no further description is given here.
In practical application, the second proxy nginx and other reverse proxy servers are realized.
Illustratively, as shown in fig. 8, the first agent and the second agent may be deployed simultaneously, and the first agent and the second agent may be implemented using a reverse proxy server such as nginx. The domain names of the first agent and the second agent are different. A user may send traffic to a first agent (e.g., www.xxx.com nginx) using a network front end such as an Application (APP) or a network access (WEB). The user may also send traffic to a second agent (e.g., test. Xxx. Com-nginx) using a network front end such as an Application (APP) or a network access (WEB).
When a user (including APP and WEB) logs in, a first agent reads a flow identifier, if the flow identifier is a first flow identifier (such as test), the first agent forwards the flow to a first environment (such as a namespace), and if the flow identifier is a second flow identifier (such as production), the first agent forwards the flow to a second environment (such as a stable). The network front end can also directly access the second proxy domain name and directly connect to the first environment, and the traffic does not need to be configured with a traffic identifier.
Thus, by configuring two agents, the system can be connected to different environments through the traffic identification, and can also be connected to a specific environment in a notification direct access mode, namely, a plurality of modes for switching between different services are provided, and the flexibility of selecting different services is improved.
As shown in fig. 9, an embodiment of the present disclosure provides a service publishing method, including:
step 901: and determining the test result as a second result, and setting the flow identifier of the first flow as the second flow identifier.
In some embodiments, step 901 may be implemented separately.
In some embodiments, step 901 may be implemented in combination with at least one of step 201, step 202, step 203, step 204, and step 701.
Here, the second result may include a result that the test fails.
If the service to be tested fails the test, the flow identification of the user can be configured through software background and the like. For example, the flow identification in the user cookies is modified from the first flow identification to the second flow identification, so that the flow sent by the user adopts the first formal service processing, the influence on the user caused by the abnormal processing of the service to be tested is reduced, and the user experience is improved.
Therefore, the flow of the user can be switched from the service to be tested to the first formal service under the condition that the perception of the user is not influenced, and the user experience is improved.
As shown in fig. 10, an embodiment of the present disclosure provides a service publishing method, including:
Step 1001: and determining the test result as a second result, and sending first indication information, wherein the first indication information is used for indicating to adjust the flow identifier of the first flow to a second flow identifier.
In some embodiments, step 1001 may be implemented separately.
In some embodiments, step 1001 and/or step 1002 may be implemented in combination with at least one of step 201, step 202, step 203, step 204, step 701, and step 901.
Here, the first proxy determines that the test result of the service to be tested is the second result, and may also send first indication information to a user end (client end) such as an application used by the user and/or a web browser, to instruct the user end to adjust the flow identifier of the user to be the second flow identifier, so that the flow sent by the user adopts the first formal service processing.
In one possible implementation, since the test result is the second result, errors may occur in the service processing flow to be tested, which may affect the customer experience. The first proxy can send the first indication information to the user side with the current flow identifier being the first flow identifier, so that all the flows are forwarded to the first formal service processing, thereby reducing the influence of the processing of the service to be tested on the user and improving the user experience. Meanwhile, the flow of the user can be switched from the service to be tested to the first formal service under the condition that the perception of the user is not influenced, so that the user experience is improved.
As shown in fig. 11, an embodiment of the present disclosure provides a service publishing method, including:
Step 1101: determining that the second formal service in the second environment is abnormal, rolling back the service of the first environment to the first formal service, and forwarding all traffic to the first environment;
Step 1102: and rolling back the second formal service of the second environment to the first formal service, and forwarding all traffic to the second environment.
In some embodiments, step 1101 and/or step 1102 may be implemented separately.
In some embodiments, step 1101 and/or step 1102 may be implemented in combination with at least one of step 201, step 202, step 203, step 204, step 701, step 901, and step 1001.
If an anomaly occurs in a second formal service in a second environment, a rollback to the first formal service is required. Because the second formal service is switched to the second environment, all traffic adopts the second traffic identifier, and the process of the user traffic is interrupted by directly replacing the second formal service in the second environment. Thus, a first formal service may be deployed first in a first environment and all traffic currently is cut to the first environment (i.e., the traffic identifications of all traffic are adjusted to a first traffic identification). Thus, the user traffic can be processed by the first formal service in the first environment, and the service interruption condition is reduced.
After all the current traffic is switched to the first environment, since the second environment has no traffic, the second formal service in the second environment can be rolled back to the first formal service, and all the traffic is switched to the second environment (i.e. the traffic identification of all the traffic is adjusted to the second traffic identification), thereby completing the service rollback. In the rollback process, the service is not interrupted, so that the flexible and stable switching of the flow between two environments is realized.
In some embodiments, after the service rollback, the service to be tested may be redeployed in the first environment for testing, and the specific method is described in steps 201 to 204, which are not repeated herein.
A number of specific examples are provided below in connection with any of the embodiments described above:
A service distribution method, as shown in fig. 12, includes steps 1201 to 1207.
As shown in fig. 8, the background architecture may adopt a micro-service manner, uses nacos as a registry, all externally initiated requests are transferred through a gateway, and multiple isolated environments (first environment and second environment), called test environment (test) and production environment (stable), can be created through a nacos namespace, and the test environment and the production environment are mutually dependent and isolated and do not affect each other, but use the same database, and share a set of data sources. For external access, each namespace provides a gateway, and the front end (application and/or web browser) realizes the switching between the test environment and the production environment by forwarding different domain names or ngix to different gateways according to different request heads.
Step 1201: and establishing a database. The database (DDL) is updated in advance, so that the data structure is compatible with new and old versions. Specifically, only the field is added, the field is not reduced, and the type and meaning of the field are not changed.
Step 1202: and (5) back-end testing environment deployment. Configuration jenkins builds a script, updates the backend services of the test environment. After the update is completed, the traffic identification of the test enterprise (i.e., the first user) is configured to the test environment.
Step 1203: and forwarding different environments according to the traffic identification or forwarding the traffic according to the accessed proxy. When the front end (including APP and WEB) logs in, the flow identifier is read, the nginx forwards the request to the test environment if the request is a test (namely, a first flow identifier), and the request is forwarded to the production environment if the request is a production (namely, a second flow identifier). The front end can also directly access the domain name of the test environment and directly connect to the test environment, and the flow identification does not need to be configured at the moment, so that the method is mainly used for internal testers. For example, an APP may use this approach to do testing in a testing environment.
Step 1204: and (5) testing the testing environment. The test environment starts functional and performance tests, and after a problem (Bug) is found, the test environment is developed, solved and redeployed, and the test is tested and verified again.
Step 1205: after all verification passes without problems, the production environment is deployed. All enterprise (user) traffic identities switch back to the production environment.
Step 1206: and (5) testing the production environment. After the production environment is deployed, the functions and performance tests are performed again, and after all the functions and performance tests pass, the release is completed.
Step 1207: abnormal rollback. When the new version is abnormal and needs to be rolled back (the abnormality is smaller or can be processed in a short time), because all the current flow is in the production environment, firstly rolling back the codes of the test environment, and then cutting all the flow to the test environment, at the moment, the production environment has no flow, rolling back the codes of the production environment, switching the flow to the production environment again, and finishing the rolling back. The retest environment verifies the new version function, and after all solutions, the release process of steps 1202-1206 is repeated and release is performed again.
If the exception is large or cannot be resolved for a short period of time, roll back to the last stable version.
Sources from which new versions are known to be abnormal can be generally classified into 3 types:
1. user feedback to platform docking personnel
2. The test personnel feed back to the platform butt joint personnel
3. System log monitoring system fault reporting/abnormal operation
When the target enterprise IS required to be switched from the internal testing version (service to be tested) to the stable version (first formal service) in the paths 1 and 2, the background can directly configure the enterprise flow identifier, and the flow identifier IS_CANARY in the cookies of the enterprise IS modified from 1 to 0.
In the case of approach 3, the exception is usually severe, and it is necessary to switch all enterprise users of the introspective version to the original stable version. Namely, when the system log monitors that the system reports errors/operation anomalies, the nginx server pushes messages (namely first indication information) to the client (browser) in real time through websocket, and the client automatically modifies the flow identification (IS_CANARY) in the cookies
(Modified from 1 to 0), the subsequent enterprise can forward to the stable version (old version) through the nginx traffic. If the target enterprise IS monitored to be switched to the internal measurement version and reported to be abnormal, the browser IS informed of modifying the flow identification (IS_CANARY) in the cookies of all enterprises to be 0 according to the mechanism, so that the background IS automatically updated to the original stable version without perception when the target enterprise executes the next operation, normal function realization IS realized, and user experience IS ensured. And other enterprises originally configured as the internal measurement version can acquire the code of the stable version for function realization because the flow identifier (IS_CANARY) in the acquired latest cookies IS 0 when other enterprises log in due to the current trigger, so that the user experience of other users IS not affected when the internal measurement version goes wrong.
Fig. 13 shows that an embodiment of the present application provides a service issuing apparatus 10, including: a processing module 110 for:
Isolating a first environment and a second environment in which a service to be tested and a first formal service are respectively located by adopting a naming space;
forwarding a first flow with a first flow identifier in all flows to the first environment, and processing the first flow by the service to be tested so as to test the service to be tested;
Forwarding a second flow with a second flow identifier in all flows to the second environment, and processing the second flow by the first formal service;
And adjusting the service to be tested based on the test result of the service to be tested.
In some embodiments, the processing module is specifically configured to:
determining, by a first agent, a traffic identification of a traffic accessing the first agent from among the all traffic;
Forwarding, by the first agent, the first traffic with the first traffic identification to the first environment.
In some embodiments, the processing module is specifically configured to:
Forwarding, by the first agent, the second traffic having the second traffic identification to the second environment.
In some embodiments, the processing module is further to:
and forwarding a third flow which accesses the second agent in all the flows to the first environment by adopting the second agent, and processing the third flow by the service to be tested so as to test the service to be tested.
In some embodiments, the processing module is specifically configured to:
Determining the test result as a first result, and determining the service to be tested as a second formal service;
updating the first formal service with the second formal service in the second environment;
And setting the flow marks of all flows as the second flow mark.
In some embodiments, the processing module is further to:
and determining the test result as a second result, and setting the flow identifier of the first flow as the second flow identifier.
In some embodiments, the processing module is further to:
Determining that the second formal service in the second environment is abnormal, rolling back the service of the first environment to the first formal service, and forwarding all traffic to the first environment;
And rolling back the second formal service of the second environment to the first formal service, and forwarding all traffic to the second environment.
In some embodiments, the apparatus further comprises:
the transceiver module 120 is configured to determine that the test result is a second result, and send first indication information, where the first indication information is used to indicate that the flow identifier of the first flow is adjusted to be a second flow identifier.
It should be understood that the division of each unit or module in the above apparatus is merely a division of a logic function, and may be fully or partially integrated into one physical entity or may be physically separated when actually implemented. Furthermore, units or modules in the apparatus may be implemented in the form of processor-invoked software: the device comprises, for example, a processor, the processor being connected to a memory, the memory having instructions stored therein, the processor invoking the instructions stored in the memory to perform any of the methods or to perform the functions of the units or modules of the device, wherein the processor is, for example, a general purpose processor, such as a central processing unit (Central Processing Unit, CPU) or microprocessor, and the memory is internal to the device or external to the device. Or a unit or module in the apparatus may be implemented in the form of a hardware circuit, and the functions of some or all of the unit or module may be implemented by the design of the hardware circuit, where the hardware circuit may be understood as one or more processors; for example, in one implementation, the hardware circuit is an application-specific integrated circuit (ASIC), and the functions of some or all of the units or modules are implemented by designing a logic relationship of elements in the circuit; for another example, in another implementation, the hardware circuit may be implemented by a programmable logic device (programmable logic device, PLD), for example, a field programmable gate array (Field Programmable GATE ARRAY, FPGA), which may include a large number of logic gates, and the connection relationship between the logic gates is configured by a configuration file, so as to implement the functions of some or all of the units or modules. All units or modules of the above device may be realized in the form of invoking software by a processor, or in the form of hardware circuits, or in part in the form of invoking software by a processor, and in the rest in the form of hardware circuits.
In the disclosed embodiment, the processor is a circuit with signal processing capability, and in one implementation, the processor may be a circuit with instruction reading and running capability, such as a central processing unit (Central Processing Unit, CPU), a microprocessor, a graphics processor (graphics processing unit, GPU) (which may be understood as a microprocessor), or a digital signal processor (DIGITAL SIGNAL processor, DSP), etc.; in another implementation, the processor may implement a function through a logic relationship of hardware circuits that are fixed or reconfigurable, such as a hardware circuit implemented as an application-specific integrated circuit (ASIC) or a programmable logic device (programmable logic device, PLD), such as an FPGA. In the reconfigurable hardware circuit, the processor loads the configuration document, and the process of implementing the configuration of the hardware circuit may be understood as a process of loading instructions by the processor to implement the functions of some or all of the above units or modules. Furthermore, a hardware circuit designed for artificial intelligence may be also be considered as an ASIC, such as a neural network Processing Unit (Neural Network Processing Unit, NPU), tensor Processing Unit (Tensor Processing Unit, TPU), deep learning Processing Unit (DEEP LEARNING Processing Unit, DPU), etc.
Fig. 10 is a schematic structural diagram of an electronic device 9100 provided by an embodiment of the present disclosure. The electronic device 9100 may be a network device, a terminal (e.g., user equipment, etc.), a chip system, a processor, etc. that supports the network device to implement any of the above methods, or a chip, a chip system, a processor, etc. that supports the terminal to implement any of the above information transmission methods. The electronic device 9100 may be configured to implement the service delivery method described in the above method embodiment, and specifically, reference may be made to the description in the above method embodiment.
As shown in fig. 10, the electronic device 9100 includes one or more processors 9101. The processor 9101 may be a general-purpose processor or a special-purpose processor, or the like. The processor 9101 is configured to invoke instructions to cause the electronic device 9100 to perform any of the above service delivery methods.
In some embodiments, electronic device 9100 further comprises one or more memories 9102 for storing instructions. Alternatively, all or a portion of memory 9102 may be external to electronic device 9100.
In some embodiments, the electronic device 9100 further comprises one or more transceivers 9103. Where the electronic device 9100 includes one or more transceivers 9103, the steps of transmitting, receiving, and/or acquiring of the methods described above are performed by the transceivers 9103, and the other steps are performed by the processors 9101.
In some embodiments, the steps of obtaining and the like in the above method may also be performed by the processor 9101, for example, obtaining information from the memory 9102 and the like.
In some embodiments, the transceiver may include a receiver and a transmitter, which may be separate or integrated. Alternatively, terms such as transceiver, transceiver unit, transceiver circuit, etc. may be replaced with each other, terms such as transmitter, transmitter circuit, etc. may be replaced with each other, and terms such as receiver, receiving unit, receiver, receiving circuit, etc. may be replaced with each other.
Optionally, the electronic device 9100 further includes one or more interface circuits 9104, where the interface circuits 9104 are connected to the memory 9102, and the interface circuits 9104 can be used to receive signals from the memory 9102 or other apparatus, and can be used to send signals to the memory 9102 or other apparatus. For example, the interface circuit 9104 may read instructions stored in the memory 9102 and send the instructions to the processor 9101.
The electronic device 9100 in the above embodiment description may be a network device or a terminal, but the scope of the electronic device 9100 described in the present disclosure is not limited thereto, and the structure of the electronic device 9100 may not be limited by fig. 10. The electronic device may be a stand-alone device or may be part of a larger device. For example, the electronic device may be: (1) A stand-alone integrated circuit IC, or chip, or a system-on-a-chip or subsystem; (2) A set of one or more ICs, optionally including storage means for storing data, programs; (3) an ASIC, such as a Modem (Modem); (4) modules that may be embedded within other devices; (5) A receiver, a terminal device, an intelligent terminal device, a cellular phone, a wireless device, a handset, a mobile unit, a vehicle-mounted device, a network device, a cloud device, an artificial intelligent device, and the like; (6) others, and so on.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the above method embodiments may be implemented by hardware related to a program command, and the foregoing program may be stored in a storage medium, where the storage medium includes: a mobile storage device, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or a optical disk, or the like, which can store program codes.
Or the above-described integrated units of the application may be stored in a computer-readable storage medium if implemented in the form of software functional modules and sold or used as separate products. Based on such understanding, the technical solutions of the embodiments of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium, comprising several commands for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a removable storage device, ROM, RAM, magnetic or optical disk, or other medium capable of storing program code.
It should be understood that the above examples are illustrative and are not intended to encompass all possible implementations encompassed by the claims. Various modifications and changes may be made in the above embodiments without departing from the scope of the disclosure. Likewise, the individual features of the above embodiments can also be combined arbitrarily to form further embodiments of the invention which may not be explicitly described. Therefore, the above examples merely represent several embodiments of the present invention and do not limit the scope of protection of the patent of the present invention.

Claims (10)

1. A service distribution method, comprising:
Isolating a first environment and a second environment in which a service to be tested and a first formal service are respectively located by adopting a naming space;
forwarding a first flow with a first flow identifier in all flows to the first environment, and processing the first flow by the service to be tested so as to test the service to be tested;
Forwarding a second flow with a second flow identifier in all flows to the second environment, and processing the second flow by the first formal service;
And adjusting the service to be tested based on the test result of the service to be tested.
2. The method of claim 1, wherein forwarding a first one of all traffic having a first traffic identification to the first environment comprises:
determining, by a first agent, a traffic identification of a traffic accessing the first agent from among the all traffic;
Forwarding, by the first agent, the first traffic with the first traffic identification to the first environment.
3. The method of claim 2, wherein forwarding the second traffic having the second traffic identification from among all traffic to the second environment comprises:
Forwarding, by the first agent, the second traffic having the second traffic identification to the second environment.
4. The method according to claim 1, wherein the method further comprises:
and forwarding a third flow which accesses the second agent in all the flows to the first environment by adopting the second agent, and processing the third flow by the service to be tested so as to test the service to be tested.
5. The method of claim 1, wherein adjusting the service under test based on the test results of the service under test comprises:
Determining the test result as a first result, and determining the service to be tested as a second formal service;
updating the first formal service with the second formal service in the second environment;
And setting the flow marks of all flows as the second flow mark.
6. The method according to claim 1, wherein the method further comprises:
and determining the test result as a second result, and setting the flow identifier of the first flow as the second flow identifier.
7. The method of claim 5, wherein the method further comprises:
Determining that the second formal service in the second environment is abnormal, rolling back the service of the first environment to the first formal service, and forwarding all traffic to the first environment;
And rolling back the second formal service of the second environment to the first formal service, and forwarding all traffic to the second environment.
8. A service distribution apparatus, comprising: a processing module for:
Isolating a first environment and a second environment in which a service to be tested and a first formal service are respectively located by adopting a naming space;
forwarding a first flow with a first flow identifier in all flows to the first environment, and processing the first flow by the service to be tested so as to test the service to be tested;
Forwarding a second flow with a second flow identifier in all flows to the second environment, and processing the second flow by the first formal service;
And adjusting the service to be tested based on the test result of the service to be tested.
9. An electronic device, the electronic device comprising:
one or more processors;
Wherein the processor is configured to invoke instructions to cause the electronic device to perform the service delivery method of any of claims 1 to 7.
10. A storage medium storing instructions that, when executed on an electronic device, cause the electronic device to perform the service delivery method of any one of claims 1 to 7.
CN202410460046.5A 2024-04-17 Service issuing method, device, electronic equipment and storage medium Pending CN118295689A (en)

Publications (1)

Publication Number Publication Date
CN118295689A true CN118295689A (en) 2024-07-05

Family

ID=

Similar Documents

Publication Publication Date Title
CN114787781B (en) System and method for enabling high availability managed failover services
US20240064058A1 (en) Implementation of compliance settings by a mobile device for compliance with a configuration scenario
US8990778B1 (en) Shadow test replay service
CN109104483B (en) Micro-service dynamic load balancing method and device based on event notification
US20230199534A1 (en) Service producer health-check
US11736344B2 (en) Containing a faulty stimulus in a content delivery network
CN112685287A (en) Product data testing method and device, storage medium and electronic device
CN109992279A (en) Method for updating configuration data, calculates equipment and storage medium at device
WO2022197604A1 (en) Methods, systems, and computer readable media for autonomous network test case generation
CN118295689A (en) Service issuing method, device, electronic equipment and storage medium
CN112527669A (en) Self-testing method and system for local service
US11777810B2 (en) Status sharing in a resilience framework
CN113179332B (en) Method, electronic device and storage medium for acquiring configuration information
CN115002107A (en) Method, system, equipment and storage medium for deploying fragment service
US10963331B2 (en) Collecting repeated diagnostics data from across users participating in a document collaboration session
CN113032000A (en) Intelligent operation data management device and method and computer system
CN117155762A (en) Fault isolation method and related device
CN116954663A (en) Cloud container gray level release method based on Kubernetes
CN116860881A (en) Data synchronization method, data synchronization device and electronic device
CN117786250A (en) Product route configuration method, device, equipment and storage medium
CN116627458A (en) Server firmware refreshing method and device
CN117909143A (en) Method and device for processing project data, storage medium and electronic equipment
CN116126687A (en) Interface simulation method and device, electronic equipment and storage medium
CN117240909A (en) Service cancellation method, device, storage medium and apparatus
CN118312400A (en) Data storage method and device and related equipment

Legal Events

Date Code Title Description
PB01 Publication