WO2017036332A1 - 一种基于分布式系统的灰度发布方法、客户端及平台 - Google Patents

一种基于分布式系统的灰度发布方法、客户端及平台 Download PDF

Info

Publication number
WO2017036332A1
WO2017036332A1 PCT/CN2016/096581 CN2016096581W WO2017036332A1 WO 2017036332 A1 WO2017036332 A1 WO 2017036332A1 CN 2016096581 W CN2016096581 W CN 2016096581W WO 2017036332 A1 WO2017036332 A1 WO 2017036332A1
Authority
WO
WIPO (PCT)
Prior art keywords
service
service unit
target
identifier
data table
Prior art date
Application number
PCT/CN2016/096581
Other languages
English (en)
French (fr)
Inventor
赵昆
张俊
何乐
张�杰
Original Assignee
阿里巴巴集团控股有限公司
赵昆
张俊
何乐
张�杰
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 阿里巴巴集团控股有限公司, 赵昆, 张俊, 何乐, 张�杰 filed Critical 阿里巴巴集团控股有限公司
Publication of WO2017036332A1 publication Critical patent/WO2017036332A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs

Definitions

  • the present invention relates to the field of big data processing technologies, and in particular to a grayscale publishing method based on a distributed system, and a grayscale publishing client based on a distributed system, and a grayscale publishing platform based on a distributed system .
  • Grayscale publishing refers to a publishing method that can smoothly transition between black and white.
  • AB test is a grayscale publishing method, which allows some users to continue to use A, and some users start to use B. If the user has nothing to B. Oppose the comments, then gradually expand the scope and move all users to B.
  • the grayscale release can ensure the stability of the overall system, and the problem can be found and adjusted at the initial gray level to ensure its influence.
  • the processing related to grayscale distribution in the related art is to start from a web service scenario, and form grayscale data according to webpage link address information, IP address information, and requested cookie information, and determine whether to participate in grayscale distribution according to grayscale data; Either grayscale publishing is performed from the dimension of the request type, and the grayscale publishing sequence table is used to decide whether to forward the request to the new version.
  • the publishing sequence table defines the grayscale publishing order of different types of requests, and uses the user number information to Decide whether to publish to the new version; or perform grayscale publishing from the perspective of improving the evaluation of key indicators, and use the preset request to perform indicator evaluation and data statistics to determine whether to release the version.
  • the technical problem to be solved by the embodiments of the present application is to provide a grayscale publishing method based on a distributed system for distributing a new version using grayscale publishing in a distributed system.
  • the embodiment of the present application further provides a grayscale publishing method based on a distributed system and a grayscale publishing platform based on a distributed system, to ensure implementation and application of the foregoing method.
  • the embodiment of the present application discloses a grayscale publishing method based on a distributed system, where the distributed system includes a plurality of mutually independent service units, and each service unit is used to provide services for multiple service projects.
  • the service unit includes a source service unit that is a service unit that has not been service upgraded, and a target service unit that is a service unit that has undergone service upgrade;
  • the method includes:
  • the target business item is a business item that is switched from the source service unit to the target service unit in the grayscale publishing process
  • the step of determining a target service unit corresponding to the target service item identifier comprises:
  • the service request is sent to a preset ingress service unit, where the ingress service unit is configured to search the second relationship data table for the target service item identifier, and determine the target service item identifier corresponding to Target service unit identification, and determining the target service unit identifier and itself Whether the identifiers are consistent, and the response information is returned to the client according to the determination result;
  • the response information includes determining first response information generated when the target service unit identifier is consistent with its own identifier; or determining the target
  • the second response information generated when the service unit identifier is inconsistent with the identifier of the self, the second response information includes the second relationship data table, and the second relationship data table is used to store the grayscale in the distributed system.
  • the unit is configured to search for the target service item identifier in the second relationship data table, obtain the target service unit identifier corresponding to the target service item target identifier, and determine whether the target service unit identifier is consistent with the identity of the target service unit, and And generating response information according to the determination result, returning to the client; the response information includes first response information or second response information;
  • Receiving response information returned by the ingress service unit or the corresponding service unit when the response information is the first response information, determining the ingress service unit or the corresponding service unit as a target service unit;
  • the target relationship item identifier is searched in the second relationship data table, and the target service unit identifier corresponding to the target service item identifier is obtained, and according to the target service unit.
  • the identification determines the corresponding target service unit.
  • the first relationship data table includes a first service item list and a second service item list, where the first service item list is a list of identifiers of the service items served by the source service unit, the first The service item list includes the target business item identifier; the second service item list is a list of identifiers of the business items served by the target service unit;
  • the target business item is switched from the source service unit to the target service unit in the grayscale publishing process, in the following manner:
  • the second relational data table is persisted.
  • the client communicates with the service unit via a remote procedure call protocol RPC.
  • RPC remote procedure call protocol
  • the method further includes:
  • the embodiment of the present application further discloses a grayscale publishing method based on a distributed system, where the distributed system includes a plurality of mutually independent service units, and each service unit is configured to provide services for multiple service items, where the service is provided.
  • the project includes a target service item;
  • the service unit includes a source service unit and a target service unit, the source service unit is a service unit that is not service upgraded, and the target service unit is a service unit that has performed service upgrade;
  • the method includes:
  • the method before the step of switching the target service item from the source service unit to the target service unit, the method further includes:
  • the plurality of service units load a first relational data table from a database, wherein the first relational data table stores all service units before the grayscale is released in the distributed system The mapping relationship of the corresponding business item.
  • the first relationship data table includes a first service item list and a second service item list, where the first service item list is a list of identifiers of the service items served by the source service unit, the first The service item list includes the target business item identifier; the second service item list is a list of identifiers of the business items served by the target service unit;
  • the step of switching the target business item from the source service unit to the target service unit include:
  • the second relational data table is persisted.
  • the method before the step of receiving, by the target service unit, the service request sent by the client, the method further includes:
  • the plurality of service units load the second relation data table from a database
  • the ingress service unit or the corresponding service unit determines whether the target service unit identifier is consistent with its own identity, and generates response information according to the determination result to return to the client; the response information includes determining the target service.
  • the client is configured to receive response information returned by the ingress service unit or the corresponding service unit, and determine, when the response information is the first response information, the ingress service unit or the corresponding service unit a target service unit; when the response information is the second response information, searching for the target service item identifier in the second relationship data table, obtaining a target service unit identifier corresponding to the target service item identifier, and Determining a corresponding target service unit according to the target service unit identifier.
  • the service unit performs with the client through a remote procedure call protocol RPC Communication.
  • the embodiment of the present application further discloses a grayscale publishing client based on a distributed system, where the distributed system includes a plurality of mutually independent service units, each serving unit is configured to provide services for multiple business items;
  • the service unit includes a source service unit that is a service unit that has not undergone service upgrade, and a target service unit that is a service unit that has performed service upgrade;
  • the client includes:
  • a service request generating module configured to generate a service request when detecting a business operation for the target business item; wherein the target business item is a business item that is switched from the source service unit to the target service unit in the grayscale publishing process;
  • a target service unit determining module configured to determine a target service unit corresponding to the target business item
  • a service request sending module configured to send the service request to the target service unit, where the target service unit is configured to provide a corresponding service for the target service item according to the service request, and generate service response information;
  • the service response information receiving module is configured to receive service response information returned by the target service unit.
  • the target service unit determining module comprises:
  • a determining sub-module configured to determine whether a relationship data table exists locally, the relationship data table storing a mapping relationship between all service units in the distributed system and corresponding service items; if yes, calling the first sending sub-module, if not , the second sending submodule is called;
  • a first sending submodule configured to send the service request to a preset ingress service unit, where the ingress service unit is configured to search the second relationship data table for the target service item identifier, and determine the target service And determining, by the item identifier, the target service unit identifier, and determining whether the target service unit identifier is consistent with the identifier of the target, and generating response information according to the determination result, and returning to the client; the response information includes determining the target service unit identifier.
  • a second sending submodule configured to search the target service identifier from the relationship data table, determine a service unit corresponding to the target service item identifier, and send the service request to the corresponding service unit
  • the corresponding service unit is configured to search for the target service item identifier in the second relationship data table, obtain a target service unit identifier corresponding to the target service item target identifier, and determine the target service unit identifier and its own identifier. Whether it is consistent, and, according to the judgment result, generating response information, returning to the client; the response information includes first response information or second response information;
  • a response information receiving submodule configured to receive response information returned by the ingress service unit or the corresponding service unit, where the ingress service unit or the corresponding service is when the response information is the first response information
  • the unit is determined as the target service unit; when the response information is the second response information, the target relationship item identifier is searched in the second relationship data table, and the target service unit identifier corresponding to the target service item identifier is obtained. And determining a corresponding target service unit according to the target service unit identifier.
  • the first relationship data table includes a first service item list and a second service item list, where the first service item list is a list of identifiers of the service items served by the source service unit, the first The service item list includes the target business item identifier; the second service item list is a list of identifiers of the business items served by the target service unit;
  • the target business item is switched from the source service unit to the target service unit in the grayscale publishing process, in the following manner:
  • the second relational data table is persisted.
  • the client communicates with the service unit via a remote procedure call protocol RPC.
  • RPC remote procedure call protocol
  • the client further includes:
  • a presentation module for presenting the service response information.
  • the embodiment of the present application further discloses a grayscale publishing platform based on a distributed system, where the distributed system includes a plurality of mutually independent service units, and each service unit is configured to provide services for multiple business items, the service The project includes a target service item; the service unit includes a source service unit and a target service unit, the source service unit is a service unit that is not service upgraded, and the target service unit is a service unit that has performed service upgrade;
  • the platform includes:
  • a switching module configured to switch the target service item from a source service unit to a target service unit
  • a first service request receiving module configured to receive, by the target service unit, a service request sent by a client, where the service request is a request generated when the client detects a service operation for the target service item;
  • a service response module configured to, by using the target service unit, provide a corresponding service for the target service item according to the service request, generate service response information, and return the service response information to the client.
  • the platform further comprises:
  • a first relational data table loading module configured to load, by the plurality of service units, a first relational data table from a database when the distributed system is started, wherein the first relational data table stores the distributed system The mapping relationship between all service units and corresponding business items before grayscale is released.
  • the first relationship data table includes a first service item list and a second service item list, where the first service item list is a list of identifiers of the service items served by the source service unit, the first The service item list includes the target business item identifier; the second service item a list of identifiers of the business items served by the target service unit;
  • the switching module includes:
  • a first relation data table loading submodule configured to load the first relation data table
  • An identifier removal submodule configured to search the first relationship item list from the first relationship data table, and remove the target service item identifier from the first service item list;
  • An identifier adding submodule configured to search the second relationship item list from the first relationship data table, and add the target service item identifier in the second service item list;
  • a second relation data table generating submodule configured to save the first relation data table, and generate a second relationship data table
  • the platform further comprises:
  • a second relation data table loading module configured to load, by the plurality of service units, the second relation data table from a database
  • a second service request receiving module configured to receive a service request sent by the client by using a preset ingress service unit or a service unit corresponding to the target service item identifier determined in the first relationship data table;
  • An identifier finding module configured to search for the target service item identifier in the second relationship data table by using the ingress service unit or the corresponding service unit, to obtain a target service unit identifier corresponding to the target service item target identifier ;
  • a response information generating module configured to determine, by the ingress service unit or the corresponding service unit, whether the target service unit identifier is consistent with its own identifier, and generate response information according to the determination result to return to the client;
  • the response information includes first response information generated when the target service unit identifier is determined to be consistent with its own identifier, or second response information generated when the target service unit identifier is inconsistent with its own identifier, the second response
  • the information includes the second relation data table;
  • the client is configured to receive response information returned by the ingress service unit or the corresponding service unit, and determine, when the response information is the first response information, the ingress service unit or the corresponding service unit a target service unit; when the response information is the second response message, Finding the target service item identifier in the second relationship data table, obtaining a target service unit identifier corresponding to the target service item identifier, and determining a corresponding target service unit according to the target service unit identifier.
  • the embodiments of the present application include the following advantages:
  • the embodiment of the present application can be applied to a big data computing platform such as a distributed system including a plurality of mutually independent service units.
  • a big data computing platform such as a distributed system including a plurality of mutually independent service units.
  • the client detects a service operation for a target service item that is switched from the source service unit to the target service unit, Generating a service request; and after determining the target service unit corresponding to the target business item, sending the service request to the target service unit to cause the target service unit to provide a corresponding service for the target business item.
  • This application starts from the business level (ie business project) and service level (ie service unit), through the rotation of the service unit to achieve the grayscale release for the business project, which solves the service in the big data computing platform.
  • the upgrade affects the business and basically realizes the transparency of the business.
  • FIG. 1 is a flow chart showing the steps of a first embodiment of a distributed system-based grayscale publishing method according to the present application
  • Embodiment 2 is a schematic diagram of a distributed system architecture of Embodiment 1 of a gray-scale publishing method based on a distributed system according to the present application;
  • FIG. 3 is a schematic diagram of a relational data table in Embodiment 1 of a grayscale publishing method based on a distributed system according to the present application;
  • FIG. 4 is a flow chart of steps of a second embodiment of a grayscale publishing method based on a distributed system according to the present application;
  • FIG. 5 is a structural block diagram of an embodiment of a grayscale publishing client based on a distributed system according to the present application
  • FIG. 6 is a structural block diagram of an embodiment of a grayscale publishing platform based on a distributed system of the present application.
  • FIG. 1 a flow chart of steps of a first embodiment of a gray-scale publishing method based on a distributed system of the present application is shown.
  • a plurality of mutually independent service units may be deployed in a distributed system, where the service unit refers to a complex big data distributed system.
  • the service module in the embodiment of the present application may include a source service unit and a target service unit, where the source service unit is a service unit that has not been upgraded, and the target service unit is a service upgrade. Service unit.
  • Each service unit can be set with different functional positioning. For example, for test requirements, the latest functions are required, the stability requirements are relatively low, the beta code can be deployed, the latest functions are provided, and the upgrade is relatively frequent; for stability requirements, The system is required to be stable and robust, providing 7*24 hours of uninterrupted service, and can deploy the release version code with low upgrade frequency. When the system releases a new version, the development operation and maintenance personnel can select different service units for grayscale distribution for different positioning of the service unit and the stability of the version to be released.
  • the number of service units that can be deployed in the distributed system can be determined according to the service scenario, but the number of the service units is preferably two or more in order to meet the requirements of grayscale distribution.
  • each service unit can provide services for a plurality of business items (Bussiness Project).
  • the business project refers to a set of business logic divided by the business department, for example, data import and export, data analysis and data reporting logic, the service request of the business project is processed by the service unit.
  • the embodiment of the present application may be applied to a feature triggering process, and may include the following steps:
  • Step 101 Generate a service request when the client detects a business operation for the target business item.
  • the target business item may be served from the source in the grayscale publishing process.
  • the service unit switches to the business item of the target service unit.
  • each business project has different requirements for distributed systems, or requires stability, or requires new features, and so on. For example, if a business project requires a stable operating environment, it can be run on a service unit of the corresponding function (such as a service unit that deploys the release code) to ensure stability; if the business project needs to use the latest features in time, it can run on Corresponding functional service units (such as service units that deploy beta code) and test new features.
  • a source service unit When some business items running on a lower version of a service unit (ie, a source service unit) are unable to provide certain functionality and need to use the functionality provided by a higher version of the service unit (ie, the target service unit), these business items can be degraded from the lower version.
  • the service unit switches to a high-level service unit that provides a required function.
  • the business item of the present application that switches from the lower version service unit to the higher version service unit is referred to as a target service item. If the target business project changes, the service can be switched between multiple service units to dynamically meet different needs.
  • each service unit can serve one or more business items, each business item includes an identification of the business item (for example, the target business item has a target business item identification), each service unit has one or more services.
  • the service item list of the identified item of the item is referred to as the first service item list by the source service unit, and the service item list corresponding to the target service unit is referred to as the second service item list.
  • the distributed system in the embodiment of the present application may include a client (also known as a Front-End Machine) and a meta-information storage system in addition to a plurality of service units. (Meta Store System) and Switch Module.
  • client also known as a Front-End Machine
  • meta-information storage system in addition to a plurality of service units.
  • Methoda Store System Metal Store System
  • Switch Module The switching process of the above target business item switching from the source service unit to the target service unit may be completed by the switching module.
  • the process of the handover module switching the target service item from the source service unit to the target service unit may be:
  • a Service Unit Project Mapping may be defined to store mapping relationships between all service units and corresponding business items in the distributed system.
  • the relational data table can To store a list of service items corresponding to each service unit, as shown in FIG. 3, the service item list stored by the service unit 1 includes the service items 1-3; and the service item list stored by the service unit 2 includes the service items 4-6.
  • the relational data table may include a first relational data table, which may be used to store a mapping relationship between all service units and corresponding business items before the grayscale is released in the distributed system.
  • the first relation data table may be persistently stored in a database of the meta information storage system.
  • the switching module needs to switch the target service item from the source service unit to the target service unit, the first relationship may be first loaded from the meta information storage system. Relational data table.
  • the first service item list corresponding to the source service unit may be searched from the first relationship data table.
  • the source service unit has a source service unit identifier, and the corresponding relationship between the source service unit identifier and the corresponding service item identifier is saved in the first relationship data table, and the source may be searched in the first relationship data table.
  • the service unit identifies to obtain a first service item list corresponding to the source service unit.
  • the switching module After the switching module removes the target service item identifier from the first service item list, the switching module further searches the first relationship data table for the second service item list corresponding to the target service unit, and adds the second service item list to the second service item list.
  • Target business project identifier The manner of searching for the second service item list corresponding to the target service unit from the first relationship data table is substantially similar to the manner of searching for the first service item list, and may refer to the manner of searching for the first service item list. This is not going to go into details.
  • the first relational data table in which the change operation such as the removal and the addition operation is generated may be saved, thereby obtaining the second relational data. table.
  • the embodiment of the present application can persist the second relational data table to the meta information storage system, so as to prevent the distributed system from accidentally crashing, and ensure the consistency of information every time the service unit is restored.
  • the meta-information storage system maintains the basic configuration information required by the service, and each service unit shares a set of meta-information storage systems, thereby ensuring information consistency.
  • the switching module may generate a change notification message according to the switching operation of switching the target service item from the source service unit to the target service unit, and send the change notification message to all service units. in.
  • the service unit when the backend service is started or restored from the failover, all service units have loaded the first relational data table from the meta information storage system. After all the service units receive the change notification message, the second relationship data table can be loaded from the meta information storage system. At this time, all service units have the latest SUPM.
  • the service unit upgrade of the present application may first upgrade one or several service units (target service units) by means of a round-robin upgrade, and the business items running on other un-upgraded service units (source service units) are not Affected by the upgrade.
  • the switching service module switches the service items from the unupgraded service unit to the upgraded service unit. The switching process does not interrupt the operation, and the business project can use this round-robin upgrade mechanism to achieve grayscale. The purpose of the release.
  • the target service item can be smoothly switched from the source service unit to the target service unit, so that the service item can be smoothly switched in different service units before and after the upgrade, and the handover process is substantially transparent to the upper layer user.
  • the switching operation performed by the switching module to switch the target service item from the source service unit to the target service unit is performed in the background, and the change notification message is also It is sent to the service unit in the background. That is to say, the SUPM can be perceived as the background.
  • the client at the front end cannot sense the SUPM change.
  • the client when the client detects a service operation (for example, an operation such as adding, deleting, or deleting data) to the target service item, the client may generate a service request according to the detection result, where the service request may include the target service item identifier. .
  • a service operation for example, an operation such as adding, deleting, or deleting data
  • Step 102 Determine a target service unit corresponding to the target service item.
  • step 102 may include the following sub-steps:
  • Sub-step S11 the client determines whether there is a relationship data table locally; if not, then perform sub-step S12; if yes, perform sub-step S13;
  • the client may determine whether there is any relation table SUPM locally in the client, and may include the first relation data table and/or the second relationship data table. If there is no relation data table in the client, the SUPM is empty, and the sub-step S12 can be continued. If there is a relational data table, it indicates that the SUPM is not empty, and the sub-step S13 can be continued at this time.
  • Sub-step S12 the service request is sent to a preset ingress service unit
  • the client can maintain a certain service unit of the service as the entry address.
  • the service unit as the entry address is referred to as the entry service unit in the embodiment of the present application.
  • the client can send the service request to the ingress service unit.
  • the ingress service unit After receiving the service request, the ingress service unit obtains the target business item identifier from the service request. After the switching operation of the target service item from the source service unit to the target service unit is completed, the latest SUPM is loaded in the ingress service unit, that is, the second relationship data table is loaded in the ingress service unit, and the ingress service unit can be in the Finding the target business item identifier in the second relation data table, determining a target service unit identifier corresponding to the target business item identifier, and determining whether the target service unit identifier is consistent with the identity of the target, and The judgment result generation response message is returned to the client.
  • the latest SUPM is loaded in the ingress service unit, that is, the second relationship data table is loaded in the ingress service unit, and the ingress service unit can be in the Finding the target business item identifier in the second relation data table, determining a target service unit identifier corresponding to the target business item identifier, and determining whether the target service unit identifier is consistent with the
  • the response information may include: first response information generated when the target service unit identifier is determined to be consistent with the identifier of the user; or second response information generated when the target service unit identifier is inconsistent with the identifier of the target service unit, and the second response is generated.
  • the information includes a second relational data table.
  • Sub-step S13 searching for the target service identifier from the relationship data table, determining a service unit corresponding to the target service item identifier, and sending the service request to the corresponding service unit;
  • the client may search the relationship data table for the target business item identifier, obtain the service unit identifier corresponding to the target business item identifier, and send the service request to the corresponding service unit. Identify the corresponding service unit.
  • the corresponding service unit After receiving the service request, the corresponding service unit obtains the target service item identifier from the service request. After the switching operation of the target service item from the source service unit to the target service unit is completed, the corresponding service unit is loaded with the latest SUPM, that is, the corresponding service unit is loaded with the second relation data table, and The corresponding service unit may search for the target service item identifier in the second relationship data table, determine the target service unit identifier corresponding to the target service item identifier, and determine whether the target service unit identifier is consistent with the identity of the target service unit, and if they are consistent, Generating the first response information, and returning the first response information to the client; if not, the relationship data table stored in the client is the first relation data table, and the corresponding service unit is the lower version before the upgrade.
  • the source service unit at this time, the corresponding service unit may generate second response information according to the second relationship data table, the second response information includes the second relationship data table, and the second response information is returned to the client.
  • Sub-step S14 receiving response information returned by the ingress service unit or the corresponding service unit, and determining, when the response information is the first response information, the ingress service unit or the corresponding service unit as a target a service unit; when the response information is the second response information, searching for the target service item identifier in the second relationship data table, obtaining a target service unit identifier corresponding to the target service item identifier, and according to the The target service unit identifier determines a corresponding target service unit.
  • the client After the client receives the response information returned by the ingress service unit or the corresponding service unit, Determining the type of the response information, if it is the first response information, determining that the ingress service unit or the corresponding service unit is the target service unit; if the second response information, updating the relationship data table saved by itself, that is, the first relationship
  • the data table is updated to the second relation data table, and the target business item identifier is searched in the second relation data table, the target service unit identifier corresponding to the target business item identifier is obtained, and the corresponding target service is determined according to the target service unit identifier. unit.
  • RPC Remote Procedure Call
  • RPC is a protocol for requesting services from a remote computer program through a network without understanding the underlying network technology.
  • RPC adopts a client/platform mode, the requesting program is a client, and the service provider is a platform.
  • Step 103 Send the service request to the target service unit.
  • the service request may be sent to the target service unit.
  • the corresponding service may be provided for the target business item according to the service request, and the service response information is generated.
  • the target service unit identifier corresponding to the target service item identifier may be searched in the second relationship data table, and the target service unit is determined. Whether the identifier is consistent with its own identity. Since the client has updated the local relational data table to the second relational data table and searches for the target service unit according to the second relational data table, the client performs the target service unit with the target service unit.
  • the target service item identifier search is based on the same basis and is the second relationship data table.
  • the target service unit identifier determined by the target service unit is consistent with its own identifier is affirmative.
  • the target service unit The follow-up service process can be continued, for example, service processes such as adding, deleting, and changing data and objects, to provide corresponding services for the target business project, and after the service is completed, generate service response information, and return the service response information to the client.
  • Step 104 Receive service response information returned by the target service unit.
  • the client receives the service response information returned by the target service unit, converts the format of the service response information into a format required by the client to present, and presents the converted service response information to the user.
  • the embodiment of the present application can be applied to a big data computing platform such as a distributed system including a plurality of mutually independent service units.
  • a big data computing platform such as a distributed system including a plurality of mutually independent service units.
  • the client detects a service operation for a target service item that is switched from the source service unit to the target service unit, Generating a service request; and after determining the target service unit corresponding to the target business item, sending the service request to the target service unit to cause the target service unit to provide a corresponding service for the target business item.
  • This application starts from the business level (ie business project) and service level (ie service unit), through the rotation of the service unit to achieve the grayscale release for the business project, which solves the service in the big data computing platform.
  • the upgrade affects the business and basically realizes the transparency of the business.
  • FIG. 4 a flow chart of steps of a second embodiment of a gray-scale publishing method based on a distributed system of the present application is shown.
  • the distributed system may include a plurality of mutually independent service units, and the service unit refers to a function module that accepts and processes a service request for a service in a complex big data distributed system.
  • the service unit in the service unit may include a source service unit that is a service unit that has not been service upgraded, and a target service unit that is a service unit that has undergone service upgrade.
  • Each service unit can be set with different function positioning.
  • the development operation and maintenance personnel can select different service units for grayscale distribution for different positioning of the service unit and the stability of the version to be released.
  • Each service unit is used to provide services for a variety of business projects, where the business project refers to a set of business logic divided by the business department, for example, data import and export, data analysis and data reporting logic, service requests for business projects It is all handled by the service unit.
  • a business project can include a target business project, and a target business project is a grayscale release. In the process, the business project needs to be switched from the source service unit to the target service unit. If the demand changes, the target business project can be switched between multiple service units to dynamically meet different requirements.
  • each service unit can serve one or more business items
  • each business item includes an identification of the business item (for example, the target business item has a target business item identification), and therefore each service unit has one or more services.
  • the service item list of the identified item of the item is referred to as the first service item list by the source service unit, and the service item list corresponding to the target service unit is referred to as the second service item list.
  • Step 401 Switch the target service item from a source service unit to a target service unit.
  • the distributed system in the embodiment of the present application may include a client, a meta information storage system, and a switching module in addition to a plurality of service units.
  • Step 401 can be done by the switching module.
  • step 401 may include the following sub-steps:
  • Sub-step S21 loading the first relation data table
  • the relationship data table SUPM may be defined to store a mapping relationship between all service units in the distributed system and corresponding service items, that is, the relationship data table may be stored.
  • the relationship data table may include a first relationship data table, where the first relationship data table may be used to store a mapping relationship between all service units and corresponding service items before the grayscale is released in the distributed system, and may include a first service item list and A list of second service items.
  • the first relation data table may be persistently stored in a database of the meta information storage system.
  • the switching module needs to switch the target service item from the source service unit to the target service unit, the first relationship may be first loaded from the meta information storage system. Relational data table.
  • Sub-step S22 searching for the first service item list from the first relationship data table, and removing the target service item identifier from the first service item list;
  • Sub-step S23 searching for the second service item list from the first relationship data table, Adding the target business item identifier to the second service item list;
  • Sub-step S24 saving the first relationship data table to generate a second relationship data table
  • the embodiment of the present application can persist the second relational data table to the meta information storage system, so as to prevent the distributed system from accidentally crashing, and ensure the consistency of information every time the service unit is restored.
  • the embodiment of the present application further includes the following steps, where the following steps are used to enable the client to determine the target service unit:
  • the switching module may generate a change notification message according to the switching operation of switching the target service item from the source service unit to the target service unit, and send the change notification message to all service units. in.
  • the plurality of service units may first load the first relational data table from the database. Later, when all the service units receive the change notification message, the second relation data table is loaded from the meta information storage system. At this time, all the service units have the latest SUPM.
  • the embodiment of the present application uses the meta information storage system to maintain basic configuration information required by the service, and each service unit shares a set of meta information storage system, thereby ensuring information consistency.
  • the client when the client detects a service operation (for example, an operation such as adding, deleting, or deleting data) to the target service item, the client may generate a service request according to the detection result, where the service request may include the target service item identifier. .
  • a service operation for example, an operation such as adding, deleting, or deleting data
  • the client may further determine the target service unit corresponding to the target business item. Specifically, when the client generates the service request, the client may determine whether there is any relationship table SUPM locally, and the relationship table may be The mapping relationship between all the service units in the distributed system and the corresponding service items may include the first relationship data table and/or the second relationship data table.
  • the SUPM is empty, and the client can send the service request to the ingress service unit, where the ingress service unit can be the service unit selected by the client as the ingress address.
  • the SUPM is not empty, and the client can search for the target service item identifier from the relationship data table, obtain the service unit identifier corresponding to the target service item identifier, and send the service request. Up to the corresponding service unit identifier corresponding to the service unit.
  • the ingress service unit or the corresponding service unit determines whether the target service unit identifier is consistent with its own identifier, and generates response information according to the determination result and returns the client;
  • the response information includes: determining first response information that is generated when the target service unit identifier is consistent with its own identifier; or determining second response information that is generated when the target service unit identifier is inconsistent with its own identifier.
  • the second response information includes the second relation data table.
  • the target service item identifier is obtained from the service request.
  • the latest SUPM is loaded in the ingress service unit or the corresponding service unit, that is, the ingress service unit or the corresponding service unit is loaded.
  • a relationship data table in which the ingress service unit or the corresponding service unit may search the second relationship data table for the target service item identifier, determine a target service unit identifier corresponding to the target service item identifier, and determine the target service unit.
  • the first response information is generated, and the first response information is returned to the client; if not, the relationship data table stored in the client is the first relation data table, and The ingress service unit or the corresponding service unit is a source service unit of an earlier version before the upgrade. In this case, the ingress service unit or the corresponding service unit may generate a second ring according to the second relationship data table.
  • the second response information includes the second relational data table and returns the second response information to the client.
  • the client After receiving the response information returned by the ingress service unit or the corresponding service unit, the client determines the type of the response information, and if it is the first response information, determines that the ingress service unit or the corresponding service unit is the target service unit;
  • the second response information is used to update the relationship data table saved by itself, that is, the first relation data table is updated to the second relation data table, and the target business item identifier is searched in the second relation data table, and the target business item identifier is obtained.
  • the target service unit identifier is determined, and the corresponding target service unit is determined according to the target service unit identifier.
  • the client and the service unit can communicate through the RPC.
  • Step 402 Receive, by the target service unit, a service request sent by a client.
  • the service request may be sent to the target service unit.
  • Step 403 The target service unit provides a corresponding service for the target service item according to the service request, generates service response information, and returns the service response information to the client.
  • the corresponding service may be provided for the target business item according to the service request, and the service response information is generated. Specifically, after receiving the service request, the target service unit searches for the target service unit identifier corresponding to the target service item identifier in the second relation data table, and determines whether the target service unit identifier is consistent with the identifier of the target unit, because When the client has updated the local relational data table to the second relational data table and searches for the target service unit according to the second relational data table, the client and the target service unit perform the target business item identification search based on the same basis.
  • the target service unit identifier determined by the target service unit is consistent with its own identity, and at this time, the target service unit continues to execute the subsequent service flow
  • the data is Service processes such as additions, deletions, and changes of objects are provided to provide corresponding services for the target business project. After the service is completed, the service response information is generated, and the service response information is returned to the client.
  • the client receives the service response information returned by the target service unit, and the service response information
  • the format is converted into a format required by the client to present, and the service response information after the converted format is presented to the user.
  • FIG. 5 there is shown a structural block diagram of an embodiment of a grayscale publishing client based on a distributed system, which includes a plurality of mutually independent service units, each of which is used for multiple
  • the service item provides a service;
  • the service unit includes a source service unit and a target service unit, the source service unit is a service unit that is not upgraded by a service, and the target service unit is a service unit that has performed service upgrade;
  • the client may specifically include the following modules:
  • the service request generating module 501 is configured to generate a service request when detecting a business operation for the target business item, where the target business item is a business item that is switched from the source service unit to the target service unit in the grayscale publishing process. ;
  • a service request sending module 503, configured to send the service request to the target service unit, where the target service unit is configured to provide a corresponding service for the target service item according to the service request, and generate service response information;
  • the service response information receiving module 504 is configured to receive service response information returned by the target service unit.
  • the target service unit determining module 502 includes:
  • a determining sub-module configured to determine whether a relationship data table exists locally, the relationship data table storing a mapping relationship between all service units in the distributed system and corresponding service items; if yes, calling the first sending sub-module, if not , the second sending submodule is called;
  • a first sending submodule configured to send the service request to a preset ingress service unit, where the ingress service unit is configured to search the second relationship data table for the target service item identifier, and determine the target service And determining, by the item identifier, the target service unit identifier, and determining whether the target service unit identifier is consistent with the identifier of the target, and generating response information according to the determination result, and returning to the client; the response information includes determining the target service unit identifier.
  • the first response information generated when the identifier of the target service unit is inconsistent with the identifier of the user is determined; or the second response information includes the second relationship data table;
  • the second relation data table is configured to store a mapping relationship between all service units and corresponding service items after performing grayscale publishing in the distributed system;
  • a second sending submodule configured to search the target service identifier from the relationship data table, determine a service unit corresponding to the target service item identifier, and send the service request to the corresponding service unit
  • the corresponding service unit is configured to search for the target service item identifier in the second relationship data table, obtain a target service unit identifier corresponding to the target service item target identifier, and determine the target service unit identifier and its own identifier. Whether it is consistent, and, according to the judgment result, generating response information, returning to the client; the response information includes first response information or second response information;
  • a response information receiving submodule configured to receive response information returned by the ingress service unit or the corresponding service unit, where the ingress service unit or the corresponding service is when the response information is the first response information
  • the unit is determined as the target service unit; when the response information is the second response information, the target relationship item identifier is searched in the second relationship data table, and the target service unit identifier corresponding to the target service item identifier is obtained. And determining a corresponding target service unit according to the target service unit identifier.
  • the first relationship data table includes a service item list and a second service item list, the first service item list being a list of identifiers of the service items served by the source service unit, the first service item list including the target service item identifier;
  • the second service item list is a list of identifiers of the business items served by the target service unit;
  • the target business item is switched from the source service unit to the target service unit in the grayscale publishing process, in the following manner:
  • the second relational data table is persisted.
  • the client communicates with the service unit through a remote procedure call protocol RPC.
  • the client further includes:
  • a presentation module for presenting the service response information.
  • the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
  • FIG. 6 there is shown a structural block diagram of an embodiment of a grayscale publishing platform based on a distributed system, which includes a plurality of mutually independent service units, each of which is used for multiple services.
  • the project provides a service
  • the business project includes a target business project
  • the service unit includes a source service unit and a target service unit, the source service unit is a service unit that is not service upgraded, and the target service unit is a service upgrade Service unit;
  • the platform may include the following modules:
  • a switching module 601 configured to switch the target service item from a source service unit to a target service Unit
  • the first service request receiving module 602 is configured to receive, by the target service unit, a service request sent by a client, where the service request is a request generated by the client when detecting a service operation for the target service item ;
  • the service response module 603 is configured to: by using the target service unit, provide a corresponding service for the target service item according to the service request, generate service response information, and return the service response information to the client.
  • the platform further includes:
  • a first relational data table loading module configured to load, by the plurality of service units, a first relational data table from a database when the distributed system is started, wherein the first relational data table stores the distributed system The mapping relationship between all service units and corresponding business items before grayscale is released.
  • the first relationship data table includes a first service item list and a second service item list, where the first service item list is a service item served by the source service unit. a list of identifiers, the first service item list including the target business item identifier; the second service item list being a list of identifiers of the business items served by the target service unit;
  • the switching module 601 includes:
  • a first relation data table loading submodule configured to load the first relation data table
  • An identifier removal submodule configured to search the first relationship item list from the first relationship data table, and remove the target service item identifier from the first service item list;
  • An identifier adding submodule configured to search the second relationship item list from the first relationship data table, and add the target service item identifier in the second service item list;
  • a second relation data table generating submodule configured to save the first relation data table, and generate a second relationship data table
  • the method further includes:
  • a second relational data table loading module configured to load the plurality of service units from a database The second relation data table
  • a second service request receiving module configured to receive a service request sent by the client by using a preset ingress service unit or a service unit corresponding to the target service item identifier determined in the first relationship data table;
  • An identifier finding module configured to search for the target service item identifier in the second relationship data table by using the ingress service unit or the corresponding service unit, to obtain a target service unit identifier corresponding to the target service item target identifier ;
  • a response information generating module configured to determine, by the ingress service unit or the corresponding service unit, whether the target service unit identifier is consistent with its own identifier, and generate response information according to the determination result to return to the client;
  • the response information includes first response information generated when the target service unit identifier is determined to be consistent with its own identifier, or second response information generated when the target service unit identifier is inconsistent with its own identifier, the second response
  • the information includes the second relation data table;
  • the client is configured to receive response information returned by the ingress service unit or the corresponding service unit, and determine, when the response information is the first response information, the ingress service unit or the corresponding service unit a target service unit; when the response information is the second response information, searching for the target service item identifier in the second relationship data table, obtaining a target service unit identifier corresponding to the target service item identifier, and Determining a corresponding target service unit according to the target service unit identifier.
  • the client communicates with the service unit through a remote procedure call protocol RPC.
  • embodiments of the embodiments of the present application may be provided as a method, Device, or computer program product. Therefore, the embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Moreover, embodiments of the present application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • Embodiments of the present application are described with reference to flowcharts and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the present application. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG.
  • These computer program operating instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing terminal device to produce a machine for execution by a processor of a computer or other programmable data processing terminal device
  • the operational instructions generate means for implementing the functions specified in one or more of the flow or in a block or blocks of the flowchart.
  • the computer program operating instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that operational instructions stored in the computer readable memory produce manufacturing including the operational command device
  • the operation instruction means implements the functions specified in one block or a plurality of blocks of a flow or a flow and/or a block diagram of the flowchart.
  • These computer program operating instructions can also be loaded onto a computer or other programmable data processing terminal device such that a series of operational steps are performed on the computer or other programmable terminal device to produce computer-implemented processing, such that the computer or other programmable terminal
  • the operational instructions executed on the device provide steps for implementing the functions specified in one or more blocks of the flowchart or in a flow or block of the flowchart.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

本申请实施例提供了一种基于分布式系统的灰度发布方法、客户端及平台,分布式系统包括多个相互独立的服务单元,每个服务单元用于为多种业务项目提供服务;服务单元包括源服务单元以及目标服务单元,源服务单元为未进行服务升级的服务单元,目标服务单元为已进行服务升级的服务单元;所述的方法包括:当客户端检测到针对目标业务项目的业务操作时,生成服务请求;其中,目标业务项目为在灰度发布过程中从源服务单元切换至目标服务单元的业务项目;确定与目标业务项目对应的目标服务单元;将服务请求发送至所述目标服务单元;接收目标服务单元返回的服务响应信息。本申请可以在分布式系统中使用灰度发布进行新版本的发布。

Description

一种基于分布式系统的灰度发布方法、客户端及平台 技术领域
本申请涉及大数据处理技术领域,特别是涉及一种基于分布式系统的灰度发布方法,以及一种基于分布式系统的灰度发布客户端,以及一种基于分布式系统的灰度发布平台。
背景技术
互联网产品在发布新版本时,为了降低新版本发布带来的风险,通常采用灰度发布的方式。灰度发布是指在黑与白之间,能够平滑过渡的一种发布方式,AB test就是一种灰度发布方式,让一部分用户继续用A,一部分用户开始用B,如果用户对B没有什么反对意见,那么逐步扩大范围,把所有用户都迁移到B上面来。灰度发布可以保证整体系统的稳定,在初始灰度的时候就可以发现、调整问题,以保证其影响度。
相关技术中关于灰度发布的处理,要么是从web服务场景出发,根据网页链接地址信息、IP地址信息和请求的Cookie信息构成了灰度数据,并根据灰度数据判断是否参与灰度发布;要么是从请求类型的维度进行灰度发布,根据灰度发布顺序表来决定是否将请求转发到新版本上,该发布顺序表定义了不同类型请求的灰度发布顺序,以及利用用户号码信息来决定是否要发布到新版本上;或者是从提高评估关键指标的角度来进行灰度发布,通过创建的预设请求来进行指标评估和数据统计,用于判定是否发布版本。
发明人在实现上述相关技术的过程中发现,上述技术都不是从分布式系统层面提供的解决方案,但对于大规模分布式系统而言,由于每一个服务单元都会同时服务很多业务项目,而每个业务项目对系统又有不同的需求,例如或要求稳定性,或要求新功能等等,因此灰度发布对分布式系统至关重要。
因此,目前需要本领域技术人员迫切解决的一个技术问题就是:如何提出一种灰度发布的机制,用以在分布式系统中使用灰度发布进行新 版本的发布。
发明内容
本申请实施例所要解决的技术问题是提供一种基于分布式系统的灰度发布方法,用以在分布式系统中使用灰度发布进行新版本的发布。
相应的,本申请实施例还提供了一种基于分布式系统的灰度发布方法及一种基于分布式系统的灰度发布平台,用以保证上述方法的实现及应用。
为了解决上述问题,本申请实施例公开了一种基于分布式系统的灰度发布方法,所述分布式系统包括多个相互独立的服务单元,每个服务单元用于为多种业务项目提供服务;所述服务单元包括源服务单元以及目标服务单元,所述源服务单元为未进行服务升级的服务单元,所述目标服务单元为已进行服务升级的服务单元;
所述的方法包括:
当客户端检测到针对目标业务项目的业务操作时,生成服务请求;其中,所述目标业务项目为在灰度发布过程中从源服务单元切换至目标服务单元的业务项目;
确定与所述目标业务项目对应的目标服务单元;
将所述服务请求发送至所述目标服务单元,所述目标服务单元用于依据所述服务请求为所述目标业务项目提供相应的服务,并生成服务响应信息;
接收所述目标服务单元返回的服务响应信息。
优选地,所述确定与所述目标业务项目标识对应的目标服务单元的步骤包括:
客户端判断本地是否存在关系数据表,所述关系数据表存储所述分布式系统中所有服务单元与对应的业务项目的映射关系;
若否,则将所述服务请求发送至预设的入口服务单元中,所述入口服务单元用于在第二关系数据表中查找所述目标业务项目标识,确定所述目标业务项目标识对应的目标服务单元标识,并判断所述目标服务单元标识与自身 的标识是否一致,以及,根据所述判断结果生成响应信息返回客户端;所述响应信息包括判定所述目标服务单元标识与自身的标识一致时生成的第一响应信息;或者,判定所述目标服务单元标识与自身的标识不一致时生成的第二响应信息,所述第二响应信息包括所述第二关系数据表;所述第二关系数据表用于存储所述分布式系统中进行灰度发布后所有服务单元与对应的业务项目的映射关系;
若是,则从所述关系数据表中查找所述目标业务标识,确定与所述目标业务项目标识对应的服务单元,并将所述服务请求发送至所述对应的服务单元,所述对应的服务单元用于在第二关系数据表中查找所述目标业务项目标识,获得所述目标业务项目标标识对应的目标服务单元标识,并判断所述目标服务单元标识与自身的标识是否一致,以及,根据所述判断结果生成响应信息返回客户端;所述响应信息包括第一响应信息或者第二响应信息;
接收所述入口服务单元或所述对应的服务单元返回的响应信息,在所述响应信息为第一响应信息时,将所述入口服务单元或所述对应的服务单元确定为目标服务单元;在所述响应信息为第二响应信息时,在所述第二关系数据表中查找所述目标业务项目标识,获得与所述目标业务项目标识对应的目标服务单元标识,并根据所述目标服务单元标识确定对应的目标服务单元。
优选地,所述第一关系数据表包括第一服务项目列表及第二服务项目列表,所述第一服务项目列表为所述源服务单元服务的业务项目的标识组成的列表,所述第一服务项目列表包括所述目标业务项目标识;所述第二服务项目列表为所述目标服务单元服务的业务项目的标识组成的列表;
所述目标业务项目在灰度发布过程中从源服务单元切换至目标服务单元,采用如下方式:
加载所述第一关系数据表;
从所述第一关系数据表中查找所述第一服务项目列表,并将所述目标业务项目标识从所述第一服务项目列表中移除;
从所述第一关系数据表中查找所述第二服务项目列表,在所述第二服务项目列表中添加所述目标业务项目标识;
保存所述第一关系数据表,生成第二关系数据表;
持久化保存所述第二关系数据表。
优选地,所述客户端与所述服务单元通过远程过程调用协议RPC进行通信。
优选地,所述方法还包括:
展现所述服务响应信息。
本申请实施例还公开了一种基于分布式系统的灰度发布方法,所述分布式系统包括多个相互独立的服务单元,每个服务单元用于为多种业务项目提供服务,所述业务项目包括目标业务项目;所述服务单元包括源服务单元以及目标服务单元,所述源服务单元为未进行服务升级的服务单元,所述目标服务单元为已进行服务升级的服务单元;
所述的方法包括:
将所述目标业务项目从源服务单元切换至目标服务单元;
通过所述目标服务单元接收客户端发送的服务请求,其中,所述服务请求为所述客户端检测到针对所述目标业务项目的业务操作时生成的请求;
通过所述目标服务单元,依据所述服务请求为所述目标业务项目提供相应的服务,生成服务响应信息,并将所述服务响应信息返回所述客户端。
优选地,在所述将所述目标业务项目从源服务单元切换至目标服务单元的步骤之前,还包括:
当所述分布式系统启动时,所述多个服务单元从数据库中加载第一关系数据表,其中,所述第一关系数据表存储所述分布式系统中进行灰度发布前所有服务单元与对应的业务项目的映射关系。
优选地,所述第一关系数据表包括第一服务项目列表及第二服务项目列表,所述第一服务项目列表为所述源服务单元服务的业务项目的标识组成的列表,所述第一服务项目列表包括所述目标业务项目标识;所述第二服务项目列表为所述目标服务单元服务的业务项目的标识组成的列表;
所述将所述目标业务项目从源服务单元切换至目标服务单元的步骤包 括:
加载所述第一关系数据表;
从所述第一关系数据表中查找所述第一服务项目列表,将所述目标业务项目标识从所述第一服务项目列表中移除;
从所述第一关系数据表中查找所述第二服务项目列表,在所述第二服务项目列表中添加所述目标业务项目标识;
保存所述第一关系数据表,生成第二关系数据表;
持久化保存所述第二关系数据表。
优选地,在所述通过所述目标服务单元接收客户端发送的服务请求的步骤之前,还包括:
所述多个服务单元从数据库中加载所述第二关系数据表;
通过预设的入口服务单元或从所述第一关系数据表中确定的与所述目标业务项目标识对应的服务单元,接收客户端发送的服务请求;
通过所述入口服务单元或所述对应的服务单元在所述第二关系数据表中查找所述目标业务项目标识,获得所述目标业务项目标标识对应的目标服务单元标识;
所述入口服务单元或所述对应的服务单元判断所述目标服务单元标识与自身的标识是否一致,以及,根据所述判断结果生成响应信息返回客户端;所述响应信息包括判定所述目标服务单元标识与自身的标识一致时生成的第一响应信息;或者,判定所述目标服务单元标识与自身的标识不一致时生成的第二响应信息,所述第二响应信息包括所述第二关系数据表;
所述客户端用于接收所述入口服务单元或所述对应的服务单元返回的响应信息,在所述响应信息为第一响应信息时,将所述入口服务单元或所述对应的服务单元确定为目标服务单元;在所述响应信息为第二响应信息时,在所述第二关系数据表中查找所述目标业务项目标识,获得与所述目标业务项目标识对应的目标服务单元标识,并根据所述目标服务单元标识确定对应的目标服务单元。
优选地,所述服务单元通过远程过程调用协议RPC与所述客户端进行 通信。
本申请实施例还公开了一种基于分布式系统的灰度发布客户端,所述分布式系统包括多个相互独立的服务单元,每个服务单元用于为多种业务项目提供服务;所述服务单元包括源服务单元以及目标服务单元,所述源服务单元为未进行服务升级的服务单元,所述目标服务单元为已进行服务升级的服务单元;
所述的客户端包括:
服务请求生成模块,用于当检测到针对目标业务项目的业务操作时,生成服务请求;其中,所述目标业务项目为在灰度发布过程中从源服务单元切换至目标服务单元的业务项目;
目标服务单元确定模块,用于确定与所述目标业务项目对应的目标服务单元;
服务请求发送模块,用于将所述服务请求发送至所述目标服务单元,所述目标服务单元用于依据所述服务请求为所述目标业务项目提供相应的服务,并生成服务响应信息;
服务响应信息接收模块,用于接收所述目标服务单元返回的服务响应信息。
优选地,所述目标服务单元确定模块包括:
判定子模块,用于判断本地是否存在关系数据表,所述关系数据表存储所述分布式系统中所有服务单元与对应的业务项目的映射关系;若是,则调用第一发送子模块,若否,则调用第二发送子模块;
第一发送子模块,用于将所述服务请求发送至预设的入口服务单元中,所述入口服务单元用于在第二关系数据表中查找所述目标业务项目标识,确定所述目标业务项目标识对应的目标服务单元标识,并判断所述目标服务单元标识与自身的标识是否一致,以及,根据所述判断结果生成响应信息返回客户端;所述响应信息包括判定所述目标服务单元标识与自身的标识一致时生成的第一响应信息;或者,判定所述目标服务单元标识与自身的标识不一 致时生成的第二响应信息,所述第二响应信息包括所述第二关系数据表;所述第二关系数据表用于存储所述分布式系统中进行灰度发布后所有服务单元与对应的业务项目的映射关系;
第二发送子模块,用于从所述关系数据表中查找所述目标业务标识,确定与所述目标业务项目标识对应的服务单元,并将所述服务请求发送至所述对应的服务单元,所述对应的服务单元用于在第二关系数据表中查找所述目标业务项目标识,获得所述目标业务项目标标识对应的目标服务单元标识,并判断所述目标服务单元标识与自身的标识是否一致,以及,根据所述判断结果生成响应信息返回客户端;所述响应信息包括第一响应信息或者第二响应信息;
响应信息接收子模块,用于接收所述入口服务单元或所述对应的服务单元返回的响应信息,在所述响应信息为第一响应信息时,将所述入口服务单元或所述对应的服务单元确定为目标服务单元;在所述响应信息为第二响应信息时,在所述第二关系数据表中查找所述目标业务项目标识,获得与所述目标业务项目标识对应的目标服务单元标识,并根据所述目标服务单元标识确定对应的目标服务单元。
优选地,所述第一关系数据表包括第一服务项目列表及第二服务项目列表,所述第一服务项目列表为所述源服务单元服务的业务项目的标识组成的列表,所述第一服务项目列表包括所述目标业务项目标识;所述第二服务项目列表为所述目标服务单元服务的业务项目的标识组成的列表;
所述目标业务项目在灰度发布过程中从源服务单元切换至目标服务单元,采用如下方式:
加载所述第一关系数据表;
从所述第一关系数据表中查找所述第一服务项目列表,并将所述目标业务项目标识从所述第一服务项目列表中移除;
从所述第一关系数据表中查找所述第二服务项目列表,在所述第二服务项目列表中添加所述目标业务项目标识;
保存所述第一关系数据表,生成第二关系数据表;
持久化保存所述第二关系数据表。
优选地,所述客户端与所述服务单元通过远程过程调用协议RPC进行通信。
优选地,所述客户端还包括:
展现模块,用于展现所述服务响应信息。
本申请实施例还公开了一种基于分布式系统的灰度发布平台,所述分布式系统包括多个相互独立的服务单元,每个服务单元用于为多种业务项目提供服务,所述业务项目包括目标业务项目;所述服务单元包括源服务单元以及目标服务单元,所述源服务单元为未进行服务升级的服务单元,所述目标服务单元为已进行服务升级的服务单元;
所述的平台包括:
切换模块,用于将所述目标业务项目从源服务单元切换至目标服务单元;
第一服务请求接收模块,用于通过所述目标服务单元接收客户端发送的服务请求,其中,所述服务请求为所述客户端检测到针对所述目标业务项目的业务操作时生成的请求;
服务响应模块,用于通过所述目标服务单元,依据所述服务请求为所述目标业务项目提供相应的服务,生成服务响应信息,并将所述服务响应信息返回所述客户端。
优选地,所述平台还包括:
第一关系数据表加载模块,用于在所述分布式系统启动时,所述多个服务单元从数据库中加载第一关系数据表,其中,所述第一关系数据表存储所述分布式系统中进行灰度发布前所有服务单元与对应的业务项目的映射关系。
优选地,所述第一关系数据表包括第一服务项目列表及第二服务项目列表,所述第一服务项目列表为所述源服务单元服务的业务项目的标识组成的列表,所述第一服务项目列表包括所述目标业务项目标识;所述第二服务项 目列表为所述目标服务单元服务的业务项目的标识组成的列表;
所述切换模块包括:
第一关系数据表加载子模块,用于加载所述第一关系数据表;
标识移除子模块,用于从所述第一关系数据表中查找所述第一服务项目列表,将所述目标业务项目标识从所述第一服务项目列表中移除;
标识添加子模块,用于从所述第一关系数据表中查找所述第二服务项目列表,在所述第二服务项目列表中添加所述目标业务项目标识;
第二关系数据表生成子模块,用于保存所述第一关系数据表,生成第二关系数据表;
保存子模块,用于持久化保存所述第二关系数据表。
优选地,所述平台还包括:
第二关系数据表加载模块,用于所述多个服务单元从数据库中加载所述第二关系数据表;
第二服务请求接收模块,用于通过预设的入口服务单元或从所述第一关系数据表中确定的与所述目标业务项目标识对应的服务单元,接收客户端发送的服务请求;
标识查找模块,用于通过所述入口服务单元或所述对应的服务单元在所述第二关系数据表中查找所述目标业务项目标识,获得所述目标业务项目标标识对应的目标服务单元标识;
响应信息生成模块,用于通过所述入口服务单元或所述对应的服务单元判断所述目标服务单元标识与自身的标识是否一致,以及,根据所述判断结果生成响应信息返回客户端;所述响应信息包括判定所述目标服务单元标识与自身的标识一致时生成的第一响应信息;或者,判定所述目标服务单元标识与自身的标识不一致时生成的第二响应信息,所述第二响应信息包括所述第二关系数据表;
所述客户端用于接收所述入口服务单元或所述对应的服务单元返回的响应信息,在所述响应信息为第一响应信息时,将所述入口服务单元或所述对应的服务单元确定为目标服务单元;在所述响应信息为第二响应信息时, 在所述第二关系数据表中查找所述目标业务项目标识,获得与所述目标业务项目标识对应的目标服务单元标识,并根据所述目标服务单元标识确定对应的目标服务单元。
与背景技术相比,本申请实施例包括以下优点:
本申请实施例能够应用于包括多个相互独立的服务单元的分布式系统等大数据计算平台中,当客户端检测到针对从源服务单元切换至目标服务单元的目标业务项目的业务操作时,生成服务请求;并在确定与目标业务项目对应的目标服务单元后,将服务请求发送至目标服务单元,以促使目标服务单元为目标业务项目提供相应的服务。本申请从业务层面(即业务项目)和服务层面(即服务单元)两个维度出发,通过服务单元的轮转升级,实现针对业务项目的灰度发布,很好地解决了大数据计算平台中服务升级影响业务的问题,基本实现了对业务的透明。
附图说明
图1是本申请的一种基于分布式系统的灰度发布方法实施例一的步骤流程图;
图2是本申请的一种基于分布式系统的灰度发布方法实施例一的分布式系统架构图;
图3是本申请的一种基于分布式系统的灰度发布方法实施例一中的关系数据表示意图;
图4是本申请的一种基于分布式系统的灰度发布方法实施例二的步骤流程图;
图5是本申请一种基于分布式系统的灰度发布客户端实施例的结构框图;
图6是本申请一种基于分布式系统的灰度发布平台实施例的结构框图。
具体实施方式
为使本申请的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本申请作进一步详细的说明。
参照图1,示出了本申请的一种基于分布式系统的灰度发布方法实施例一的步骤流程图。
应用于本申请实施例,为了实现服务的高可用性和,在分布式系统中可以部署多个相互独立的服务单元(Service Unit),其中,服务单元是指在复杂的大数据分布式系统中,接受并处理针对业务的服务请求的功能模块,本申请实施例中的服务单元可以包括源服务单元以及目标服务单元,源服务单元为未进行服务升级的服务单元,目标服务单元为已进行服务升级的服务单元。
每个服务单元可以设置不同的功能定位,例如,对于测试性需求,要求使用最新功能,对稳定性要求相对较低,可以部署beta版代码,提供最新功能,升级相对频繁;对于稳定性需求,要求系统稳定、健壮,提供7*24小时不间断服务,可以部署release版代码,升级频率低。系统发布新版本时,开发运维人员可以针对服务单元的不同定位和要发布的版本的稳定性,选择不同的服务单元进行灰度发布。
需要说明的是,分布式系统中能够部署的服务单元的数量,可以根据业务场景确定,但为满足灰度发布的需要,该服务单元的数量优选为两个以上。
在本申请实施例中,每个服务单元可以为多种业务项目(Bussiness Project)提供服务。其中,业务项目是指业务部门所划分的一整套业务逻辑,例如,数据导入导出、数据分析和数据报表等逻辑,业务项目的服务请求是都是通过服务单元来处理的。
本申请实施例可以应用于灰度发布(feature toggle)过程中,可以包括如下步骤:
步骤101,当客户端检测到针对目标业务项目的业务操作时,生成服务请求;
在本申请实施例中,目标业务项目可以为在灰度发布过程中从源服 务单元切换至目标服务单元的业务项目。具体来说,每个业务项目对分布式系统有不同的需求,或要求稳定性,或要求新功能等等。例如,如果业务项目需要一个稳定的运行环境,则可以运行在对应功能的服务单元(例如部署release版代码的服务单元)上,保证稳定性;如果业务项目需要及时使用最新功能,则可以运行在对应功能的服务单元(例如部署beta版代码的服务单元)上,并对新功能进行测试。
当某些运行在低版本服务单元(即源服务单元)上的业务项目无法提供某些功能,需要使用高版本服务单元(即目标服务单元)提供的功能时,可以将这些业务项目由低版本服务单元切换到提供所需功能的高版本服务单元,本申请实施例将这些从低版本服务单元切换到高版本服务单元的业务项目称为目标业务项目。目标业务项目如果需求有变化,可以在多个服务单元间切换,动态满足不同的需求。
由于每个服务单元可以服务一个或多个业务项目,每个业务项目包括业务项目的标识(例如,目标业务项目具有目标业务项目标识),因此,每个服务单元都具有包括一个或多个业务项目的标识的服务项目列表,本申请实施例将源服务单元对应的服务项目列表称为第一服务项目列表,将目标服务单元对应的服务项目列表称为第二服务项目列表。
如图2的分布式系统架构图所示,本申请实施例中的分布式系统除了可以包括多个服务单元以外,还可以包括客户端(亦称前端机Front-End Machine)、元信息存储系统(Meta Store System)和切换模块(Switch Module)。上述目标业务项目从源服务单元切换至目标服务单元的切换过程可以由切换模块完成。
在一种实施方式中,切换模块将目标业务项目从源服务单元切换至目标服务单元的过程可以为:
(1)加载第一关系数据表;
如图3的关系数据表示意图所示,应用于本发明实施例,可以定义关系数据表(Service Unit Project Mapping,简称SUPM)用来存储分布式系统中所有服务单元与对应的业务项目的映射关系,即关系数据表可 以存储每个服务单元对应的服务项目列表,如图3所示,服务单元1存储的服务项目列表包括业务项目1-3;服务单元2存储的服务项目列表包括业务项目4-6。
关系数据表可以包括第一关系数据表,该第一关系数据表可以用于存储分布式系统中进行灰度发布前所有服务单元与对应的业务项目的映射关系。
该第一关系数据表可以持久化存储在元信息存储系统的数据库中,当切换模块需要将目标业务项目从源服务单元切换至目标服务单元时,可以首先从元信息存储系统中加载该第一关系数据表。
(2)从所述第一关系数据表中查找所述第一服务项目列表,并将所述目标业务项目标识从所述第一服务项目列表中移除;
当切换模块从元信息存储系统中加载了第一关系数据表以后,可以从该第一关系数据表中查找源服务单元对应的第一服务项目列表。在具体实现中,源服务单元具有源服务单元标识,在第一关系数据表中保存的是源服务单元标识与对应的业务项目标识的对应关系,则在第一关系数据表中可以通过查找源服务单元标识来获得源服务单元对应的第一服务项目列表。
在查找到第一服务项目列表以后,进一步在第一服务项目列表中查找目标业务项目标识,在查找到该目标业务项目标识以后,将该目标业务项目标识从该第一服务项目列表中移除。
(3)从所述第一关系数据表中查找所述第二服务项目列表,在所述第二服务项目列表中添加所述目标业务项目标识;
当切换模块将目标业务项目标识从第一服务项目列表中移除以后,切换模块进一步从第一关系数据表中查找目标服务单元对应的第二服务项目列表,并在第二服务项目列表中添加目标业务项目标识。其中,从第一关系数据表中查找目标服务单元对应的第二服务项目列表的方式,与上述查找第一服务项目列表的方式基本相似,具体可以参照上述查找第一服务项目列表的方式,在此不再赘述了。
(4)保存所述第一关系数据表,生成第二关系数据表;
当完成了上述步骤(2)及步骤(3)的移除和添加操作等变更操作以后,可以保存该产生了移除及添加操作等变更操作的第一关系数据表,从而得到第二关系数据表。
(5)持久化保存所述第二关系数据表。
本申请实施例可以将该第二关系数据表持久化保存到元信息存储系统中,这样可以防止分布式系统意外宕机crash时,保证每次服务单元恢复时信息的一致性。
元信息存储系统维护了服务所需要的基本配置信息,各服务单元共用一套元信息存储系统,从而保证了信息的一致性。
在持久化保存第二关系数据表的同时,切换模块可以依据上述将目标业务项目从源服务单元切换至目标服务单元的切换操作,生成变更通知消息,并将该变更通知消息发送至所有服务单元中。
在服务单元中,当后端服务启动或从failover中恢复时,所有服务单元已经从元信息存储系统中加载第一关系数据表。当所有服务单元接收到变更通知消息以后,可以从元信息存储系统中加载该第二关系数据表,此时,所有服务单元都拥有最新的SUPM。
需要说明的是,本申请的服务单元升级可以通过轮转升级的方式,先升级一个或若干服务单元(目标服务单元),运行在其他未升级的服务单元(源服务单元)上的业务项目并不受升级的影响。等待某些服务单元升级完成后,再通过切换模块,将这些业务项目由未升级的服务单元切换到升级的服务单元,切换过程不会中断作业,业务项目可以利用这种轮转升级机制达到灰度发布的目的。
在本申请实施例中目标业务项目能够从源服务单元平滑切换至目标服务单元,使得业务项目可以在升级前后的不同服务单元中平滑切换,切换流程对上层用户基本透明。
需要说明的是,上述切换模块执行的将目标业务项目从源服务单元切换至目标服务单元的切换操作,是在后台中执行的,变更通知消息也 是发送至后台的服务单元中,也就是说,能感知SUPM变更的是后台,在整个系统启动时,处于前端的客户端并不能感知SUPM变更。
在客户端侧,客户端在检测到针对目标业务项目的业务操作(例如,对数据的增删减查等操作)时,可以根据该检测结果生成服务请求,该服务请求可以包括目标业务项目标识。
步骤102,确定与所述目标业务项目对应的目标服务单元;
客户端生成服务请求后,客户端可以进一步确定该目标业务项目对应的目标服务单元。在本申请实施例的一种优选实施例中,步骤102可以包括如下子步骤:
子步骤S11,客户端判断本地是否存在关系数据表;若否,则执行子步骤S12;若是,则执行子步骤S13;
客户端在生成服务请求的同时,可以判断客户端本地是否存在任何关系表SUPM,可以包括第一关系数据表和/或第二关系数据表。若客户端本地不存在任何关系数据表,则说明SUPM为空,此时可以继续执行子步骤S12。若存在关系数据表,则说明SUPM不为空,此时可以继续执行子步骤S13。
子步骤S12,将所述服务请求发送至预设的入口服务单元中;
由于分布式系统中包括多个服务单元,因此客户端可以维护服务的某个服务单元作为入口地址,本申请实施例将该作为入口地址的服务单元称为入口服务单元。
当在客户端中不存在关系数据表时,客户端可以将服务请求发送至入口服务单元。
入口服务单元接收到服务请求后,从该服务请求中获得目标业务项目标识。由于对目标业务项目从源服务单元切换至目标服务单元的切换操作完成后,入口服务单元中加载了最新的SUPM,即入口服务单元中加载了第二关系数据表,此时入口服务单元可以在第二关系数据表中查找该目标业务项目标识,确定与该目标业务项目标识对应的目标服务单元标识,并判断目标服务单元标识与自身的标识是否一致,以及,根据上 述判断结果生成响应信息返回客户端。
具体的,该响应信息可以包括判定目标服务单元标识与自身的标识一致时生成的第一响应信息;或者,判定目标服务单元标识与自身的标识不一致时生成的第二响应信息,该第二响应信息包括第二关系数据表。
子步骤S13,从所述关系数据表中查找所述目标业务标识,确定与所述目标业务项目标识对应的服务单元,并将所述服务请求发送至所述对应的服务单元;
当在客户端中存在关系数据表,则客户端可以从该关系数据表中查找该目标业务项目标识,获得该目标业务项目标识对应的服务单元标识,并将服务请求发送至该对应的服务单元标识对应的服务单元中。
该对应的服务单元接收到服务请求后,从该服务请求中获得目标业务项目标识。由于对目标业务项目从源服务单元切换至目标服务单元的切换操作完成后,该对应的服务单元中加载了最新的SUPM,即该对应的服务单元中加载了第二关系数据表,此时该对应的服务单元可以在第二关系数据表中查找该目标业务项目标识,确定与该目标业务项目标识对应的目标服务单元标识,并判断目标服务单元标识与自身的标识是否一致,若一致,则生成第一响应信息,并将该第一响应信息返回客户端;若不一致,则说明客户端中存储的关系数据表为第一关系数据表,而该对应的服务单元为升级前较低版本的源服务单元,此时,该对应的服务单元可以依据第二关系数据表生成第二响应信息,该第二响应信息包括该第二关系数据表,并将第二响应信息返回客户端。
子步骤S14,接收所述入口服务单元或所述对应的服务单元返回的响应信息,在所述响应信息为第一响应信息时,将所述入口服务单元或所述对应的服务单元确定为目标服务单元;在所述响应信息为第二响应信息时,在所述第二关系数据表中查找所述目标业务项目标识,获得与所述目标业务项目标识对应的目标服务单元标识,并根据所述目标服务单元标识确定对应的目标服务单元。
客户端接收到入口服务单元或对应的服务单元返回的响应信息后, 判断该响应信息的类型,若为第一响应信息,则判定该入口服务单元或对应的服务单元为目标服务单元;若为第二响应信息,则更新自身保存的关系数据表,即将第一关系数据表更新为第二关系数据表,并在第二关系数据表中查找该目标业务项目标识,获得与该目标业务项目标识对应的目标服务单元标识,并根据目标服务单元标识确定对应的目标服务单元。
需要说明的是,客户端与服务单元(包括源服务单元、目标服务单元以及入口服务单元)之间,可以通过RPC(Remote Procedure Call,远程过程调用协议)进行通信。其中,RPC是一种通过网络从远程计算机程序上请求服务,而不需要了解底层网络技术的协议,RPC采用客户机/平台模式,请求程序就是一个客户机,而服务提供程序就是一个平台。虽然不同的服务单元支持的功能可能不同,但均可以保证与客户端通信格式的兼容性。
步骤103,将所述服务请求发送至所述目标服务单元;
客户端确定了与目标业务项目标识对应的目标服务单元以后,可以将该服务请求发送至该目标服务单元中。
在目标服务单元中,可以依据该服务请求为该目标业务项目提供相应的服务,并生成服务响应信息。具体来说,类似于上述子步骤S13的过程,当目标服务单元接收到服务请求后,可以在第二关系数据表中查找该目标业务项目标识对应的目标服务单元标识,并判断该目标服务单元标识与自身的标识是否一致,由于此时客户端已经将本地的关系数据表更新为第二关系数据表,并按照第二关系数据表来查找目标服务单元,则客户端与该目标服务单元进行目标业务项目标识查找的依据是相同的,都是第二关系数据表,因此,目标服务单元判定的该目标服务单元标识与自身的标识是否一致的判定结果是肯定的,此时,目标服务单元可以继续执行后续服务流程,例如,对数据、对象的增删改查等服务流程,以为目标业务项目提供相应的服务,在服务完成后,生成服务响应信息,并将服务响应信息返回客户端。
步骤104,接收所述目标服务单元返回的服务响应信息。
客户端接收目标服务单元返回的服务响应信息,将该服务响应信息的格式转换成客户端展现所需的格式,并将该转换格式后的服务响应信息展现给用户。
本申请实施例能够应用于包括多个相互独立的服务单元的分布式系统等大数据计算平台中,当客户端检测到针对从源服务单元切换至目标服务单元的目标业务项目的业务操作时,生成服务请求;并在确定与目标业务项目对应的目标服务单元后,将服务请求发送至目标服务单元,以促使目标服务单元为目标业务项目提供相应的服务。本申请从业务层面(即业务项目)和服务层面(即服务单元)两个维度出发,通过服务单元的轮转升级,实现针对业务项目的灰度发布,很好地解决了大数据计算平台中服务升级影响业务的问题,基本实现了对业务的透明。
参照图4,示出了本申请的一种基于分布式系统的灰度发布方法实施例二的步骤流程图。
应用于本申请实施例,分布式系统可以包括多个相互独立的服务单元,服务单元是指在复杂的大数据分布式系统中,接受并处理针对业务的服务请求的功能模块,本申请实施例中的服务单元可以包括源服务单元以及目标服务单元,源服务单元为未进行服务升级的服务单元,目标服务单元为已进行服务升级的服务单元。
每个服务单元可以设置不同的功能定位,系统发布新版本时,开发运维人员可以针对服务单元的不同定位和要发布的版本的稳定性,选择不同的服务单元进行灰度发布。
每个服务单元用于为多种业务项目提供服务,其中,业务项目是指业务部门所划分的一整套业务逻辑,例如,数据导入导出、数据分析和数据报表等逻辑,针对业务项目的服务请求是都是通过服务单元来处理的。业务项目可以包括目标业务项目,目标业务项目是指在灰度发布过 程中需要从源服务单元切换至目标服务单元的业务项目,目标业务项目如果需求有变化,可以在多个服务单元间切换,动态满足不同的需求。
由于每个服务单元可以服务一个或多个业务项目,每个业务项目包括业务项目的标识(例如:目标业务项目具有目标业务项目标识),因此,每个服务单元都具有包括一个或多个业务项目的标识的服务项目列表,本申请实施例将源服务单元对应的服务项目列表称为第一服务项目列表,将目标服务单元对应的服务项目列表称为第二服务项目列表。
本申请实施例可以包括如下步骤:
步骤401,将所述目标业务项目从源服务单元切换至目标服务单元;
如图2的分布式系统架构图所示,本申请实施例中的分布式系统除了可以包括多个服务单元以外,还可以包括客户端、元信息存储系统和切换模块。步骤401可以由切换模块完成。
在本申请实施例的一种优选实施例中,步骤401可以包括如下子步骤:
子步骤S21,加载所述第一关系数据表;
如图3的关系数据表示意图所示,应用于本发明实施例,可以定义关系数据表SUPM用来存储分布式系统中所有服务单元与对应的业务项目的映射关系,即关系数据表可以存储每个服务单元对应的服务项目列表。
关系数据表可以包括第一关系数据表,该第一关系数据表可以用于存储分布式系统中进行灰度发布前所有服务单元与对应的业务项目的映射关系,可以包括第一服务项目列表及第二服务项目列表。
该第一关系数据表可以持久化存储在元信息存储系统的数据库中,当切换模块需要将目标业务项目从源服务单元切换至目标服务单元时,可以首先从元信息存储系统中加载该第一关系数据表。
子步骤S22,从所述第一关系数据表中查找所述第一服务项目列表,将所述目标业务项目标识从所述第一服务项目列表中移除;
子步骤S23,从所述第一关系数据表中查找所述第二服务项目列表, 在所述第二服务项目列表中添加所述目标业务项目标识;
子步骤S24,保存所述第一关系数据表,生成第二关系数据表;
子步骤S25,持久化保存所述第二关系数据表。
本申请实施例可以将该第二关系数据表持久化保存到元信息存储系统中,这样可以防止分布式系统意外宕机crash时,保证每次服务单元恢复时信息的一致性。
优选地,本申请实施例还包括如下步骤,以下步骤用于使客户端确定目标服务单元:
1)所述多个服务单元从数据库中加载所述第二关系数据表;
在持久化保存第二关系数据表的同时,切换模块可以依据上述将目标业务项目从源服务单元切换至目标服务单元的切换操作,生成变更通知消息,并将该变更通知消息发送至所有服务单元中。
在具体实现中,在步骤401之前,当分布式系统启动时或从failover中恢复时,多个服务单元可以首先从数据库中加载第一关系数据表。后来,当所有服务单元接收到变更通知消息以后,又从元信息存储系统中加载该第二关系数据表,此时,所有服务单元都拥有最新的SUPM。
本申请实施例采用元信息存储系统维护了服务所需要的基本配置信息,各服务单元共用一套元信息存储系统,从而保证了信息的一致性。
2)通过预设的入口服务单元或从所述第一关系数据表中确定的与所述目标业务项目标识对应的服务单元,接收客户端发送的服务请求;
在客户端侧,客户端在检测到针对目标业务项目的业务操作(例如,对数据的增删减查等操作)时,可以根据该检测结果生成服务请求,该服务请求可以包括目标业务项目标识。
客户端生成服务请求后,客户端可以进一步确定该目标业务项目对应的目标服务单元,具体的,客户端在生成服务请求的同时,可以判断客户端本地是否存在任何关系表SUPM,该关系表可以存储分布式系统中所有服务单元与对应的业务项目的映射关系,可以包括第一关系数据表和/或第二关系数据表。
若客户端本地不存在任何关系数据表,则说明SUPM为空,此时客户端可以将服务请求发送至入口服务单元,其中入口服务单元可以为客户端选定的作为入口地址的服务单元。
若客户端本地存在关系数据表,则说明SUPM不为空,则客户端可以从该关系数据表中查找该目标业务项目标识,获得该目标业务项目标识对应的服务单元标识,并将服务请求发送至该对应的服务单元标识对应的服务单元中。
3)通过所述入口服务单元或所述对应的服务单元在所述第二关系数据表中查找所述目标业务项目标识,获得所述目标业务项目标标识对应的目标服务单元标识;
4)所述入口服务单元或所述对应的服务单元判断所述目标服务单元标识与自身的标识是否一致,以及,根据所述判断结果生成响应信息返回客户端;
其中,所述响应信息包括判定所述目标服务单元标识与自身的标识一致时生成的第一响应信息;或者,判定所述目标服务单元标识与自身的标识不一致时生成的第二响应信息,所述第二响应信息包括所述第二关系数据表。
具体的,当入口服务单元或对应的服务单元接收到服务请求后,从该服务请求中获得目标业务项目标识。由于对目标业务项目从源服务单元切换至目标服务单元的切换操作完成后,该入口服务单元或对应的服务单元中加载了最新的SUPM,即该入口服务单元或对应的服务单元中加载了第二关系数据表,此时该入口服务单元或对应的服务单元可以在第二关系数据表中查找该目标业务项目标识,确定与该目标业务项目标识对应的目标服务单元标识,并判断目标服务单元标识与自身的标识是否一致,若一致,则生成第一响应信息,并将该第一响应信息返回客户端;若不一致,则说明客户端中存储的关系数据表为第一关系数据表,而该入口服务单元或对应的服务单元为升级前较低版本的源服务单元,此时,该入口服务单元或对应的服务单元可以依据第二关系数据表生成第二响 应信息,该第二响应信息包括该第二关系数据表,并将第二响应信息返回客户端。
客户端接收到入口服务单元或对应的服务单元返回的响应信息后,判断该响应信息的类型,若为第一响应信息,则判定该入口服务单元或对应的服务单元为目标服务单元;若为第二响应信息,更新自身保存的关系数据表,即将第一关系数据表更新为第二关系数据表,并在第二关系数据表中查找该目标业务项目标识,获得与该目标业务项目标识对应的目标服务单元标识,并根据目标服务单元标识确定对应的目标服务单元。
需要说明的是,客户端与服务单元(包括源服务单元、目标服务单元以及入口服务单元)之间,可以通过RPC进行通信。
步骤402,通过所述目标服务单元接收客户端发送的服务请求;
客户端确定了与目标业务项目标识对应的目标服务单元以后,可以将该服务请求发送至该目标服务单元中。
步骤403,通过所述目标服务单元,依据所述服务请求为所述目标业务项目提供相应的服务,生成服务响应信息,并将所述服务响应信息返回所述客户端。
在目标服务单元中,可以依据该服务请求为该目标业务项目提供相应的服务,并生成服务响应信息。具体来说,当目标服务单元接收到服务请求后,在第二关系数据表中查找该目标业务项目标识对应的目标服务单元标识,并判断该目标服务单元标识与自身的标识是否一致,由于此时客户端已经将本地的关系数据表更新为第二关系数据表,并按照第二关系数据表来查找目标服务单元,则客户端与该目标服务单元进行目标业务项目标识查找的依据是相同的,都是第二关系数据表,因此,目标服务单元判定的该目标服务单元标识与自身的标识是否一致的判定结果是肯定的,此时,目标服务单元继续执行后续服务流程,例如,对数据、对象的增删改查等服务流程,以为目标业务项目提供相应的服务,在服务完成后,生成服务响应信息,并将服务响应信息返回客户端。
客户端接收目标服务单元返回的服务响应信息,将该服务响应信息 的格式转换成客户端展现所需的格式,并将该转换格式后的服务响应信息展现给用户。
对于图4的实施例而言,由于其与上述图1方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
需要说明的是,对于方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请实施例并不受所描述的动作顺序的限制,因为依据本申请实施例,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作并不一定是本申请实施例所必须的。
参照图5,示出了本申请一种基于分布式系统的灰度发布客户端实施例的结构框图,所述分布式系统包括多个相互独立的服务单元,每个服务单元用于为多种业务项目提供服务;所述服务单元包括源服务单元以及目标服务单元,所述源服务单元为未进行服务升级的服务单元,所述目标服务单元为已进行服务升级的服务单元;
所述的客户端具体可以包括如下模块:
服务请求生成模块501,用于当检测到针对目标业务项目的业务操作时,生成服务请求;其中,所述目标业务项目为在灰度发布过程中从源服务单元切换至目标服务单元的业务项目;
目标服务单元确定模块502,用于确定与所述目标业务项目对应的目标服务单元;
服务请求发送模块503,用于将所述服务请求发送至所述目标服务单元,所述目标服务单元用于依据所述服务请求为所述目标业务项目提供相应的服务,并生成服务响应信息;
服务响应信息接收模块504,用于接收所述目标服务单元返回的服务响应信息。
在本申请实施例的一种优选实施例中,所述目标服务单元确定模块502包括:
判定子模块,用于判断本地是否存在关系数据表,所述关系数据表存储所述分布式系统中所有服务单元与对应的业务项目的映射关系;若是,则调用第一发送子模块,若否,则调用第二发送子模块;
第一发送子模块,用于将所述服务请求发送至预设的入口服务单元中,所述入口服务单元用于在第二关系数据表中查找所述目标业务项目标识,确定所述目标业务项目标识对应的目标服务单元标识,并判断所述目标服务单元标识与自身的标识是否一致,以及,根据所述判断结果生成响应信息返回客户端;所述响应信息包括判定所述目标服务单元标识与自身的标识一致时生成的第一响应信息;或者,判定所述目标服务单元标识与自身的标识不一致时生成的第二响应信息,所述第二响应信息包括所述第二关系数据表;所述第二关系数据表用于存储所述分布式系统中进行灰度发布后所有服务单元与对应的业务项目的映射关系;
第二发送子模块,用于从所述关系数据表中查找所述目标业务标识,确定与所述目标业务项目标识对应的服务单元,并将所述服务请求发送至所述对应的服务单元,所述对应的服务单元用于在第二关系数据表中查找所述目标业务项目标识,获得所述目标业务项目标标识对应的目标服务单元标识,并判断所述目标服务单元标识与自身的标识是否一致,以及,根据所述判断结果生成响应信息返回客户端;所述响应信息包括第一响应信息或者第二响应信息;
响应信息接收子模块,用于接收所述入口服务单元或所述对应的服务单元返回的响应信息,在所述响应信息为第一响应信息时,将所述入口服务单元或所述对应的服务单元确定为目标服务单元;在所述响应信息为第二响应信息时,在所述第二关系数据表中查找所述目标业务项目标识,获得与所述目标业务项目标识对应的目标服务单元标识,并根据所述目标服务单元标识确定对应的目标服务单元。
在本申请实施例的一种优选实施例中,所述第一关系数据表包括第 一服务项目列表及第二服务项目列表,所述第一服务项目列表为所述源服务单元服务的业务项目的标识组成的列表,所述第一服务项目列表包括所述目标业务项目标识;所述第二服务项目列表为所述目标服务单元服务的业务项目的标识组成的列表;
所述目标业务项目在灰度发布过程中从源服务单元切换至目标服务单元,采用如下方式:
加载所述第一关系数据表;
从所述第一关系数据表中查找所述第一服务项目列表,并将所述目标业务项目标识从所述第一服务项目列表中移除;
从所述第一关系数据表中查找所述第二服务项目列表,在所述第二服务项目列表中添加所述目标业务项目标识;
保存所述第一关系数据表,生成第二关系数据表;
持久化保存所述第二关系数据表。
在本申请实施例的一种优选实施例中,所述客户端与所述服务单元通过远程过程调用协议RPC进行通信。
在本申请实施例的一种优选实施例中,所述客户端还包括:
展现模块,用于展现所述服务响应信息。
对于客户端实施例而言,由于其与上述方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
参照图6,示出了本申请一种基于分布式系统的灰度发布平台实施例的结构框图,所述分布式系统包括多个相互独立的服务单元,每个服务单元用于为多种业务项目提供服务,所述业务项目包括目标业务项目;所述服务单元包括源服务单元以及目标服务单元,所述源服务单元为未进行服务升级的服务单元,所述目标服务单元为已进行服务升级的服务单元;
所述的平台可以包括如下模块:
切换模块601,用于将所述目标业务项目从源服务单元切换至目标服 务单元;
第一服务请求接收模块602,用于通过所述目标服务单元接收客户端发送的服务请求,其中,所述服务请求为所述客户端检测到针对所述目标业务项目的业务操作时生成的请求;
服务响应模块603,用于通过所述目标服务单元,依据所述服务请求为所述目标业务项目提供相应的服务,生成服务响应信息,并将所述服务响应信息返回所述客户端。
在本申请实施例的一种优选实施例中,所述平台还包括:
第一关系数据表加载模块,用于在所述分布式系统启动时,所述多个服务单元从数据库中加载第一关系数据表,其中,所述第一关系数据表存储所述分布式系统中进行灰度发布前所有服务单元与对应的业务项目的映射关系。
在本申请实施例的一种优选实施例中,所述第一关系数据表包括第一服务项目列表及第二服务项目列表,所述第一服务项目列表为所述源服务单元服务的业务项目的标识组成的列表,所述第一服务项目列表包括所述目标业务项目标识;所述第二服务项目列表为所述目标服务单元服务的业务项目的标识组成的列表;
所述切换模块601包括:
第一关系数据表加载子模块,用于加载所述第一关系数据表;
标识移除子模块,用于从所述第一关系数据表中查找所述第一服务项目列表,将所述目标业务项目标识从所述第一服务项目列表中移除;
标识添加子模块,用于从所述第一关系数据表中查找所述第二服务项目列表,在所述第二服务项目列表中添加所述目标业务项目标识;
第二关系数据表生成子模块,用于保存所述第一关系数据表,生成第二关系数据表;
保存子模块,用于持久化保存所述第二关系数据表。
在本申请实施例的一种优选实施例中,还包括:
第二关系数据表加载模块,用于所述多个服务单元从数据库中加载 所述第二关系数据表;
第二服务请求接收模块,用于通过预设的入口服务单元或从所述第一关系数据表中确定的与所述目标业务项目标识对应的服务单元,接收客户端发送的服务请求;
标识查找模块,用于通过所述入口服务单元或所述对应的服务单元在所述第二关系数据表中查找所述目标业务项目标识,获得所述目标业务项目标标识对应的目标服务单元标识;
响应信息生成模块,用于通过所述入口服务单元或所述对应的服务单元判断所述目标服务单元标识与自身的标识是否一致,以及,根据所述判断结果生成响应信息返回客户端;所述响应信息包括判定所述目标服务单元标识与自身的标识一致时生成的第一响应信息;或者,判定所述目标服务单元标识与自身的标识不一致时生成的第二响应信息,所述第二响应信息包括所述第二关系数据表;
所述客户端用于接收所述入口服务单元或所述对应的服务单元返回的响应信息,在所述响应信息为第一响应信息时,将所述入口服务单元或所述对应的服务单元确定为目标服务单元;在所述响应信息为第二响应信息时,在所述第二关系数据表中查找所述目标业务项目标识,获得与所述目标业务项目标识对应的目标服务单元标识,并根据所述目标服务单元标识确定对应的目标服务单元。
在本申请实施例的一种优选实施例中,所述客户端与所述服务单元通过远程过程调用协议RPC进行通信。
对于平台实施例而言,由于其与上述方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。
本领域内的技术人员应明白,本申请实施例的实施例可提供为方法、 装置、或计算机程序产品。因此,本申请实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本申请实施例是参照根据本申请实施例的方法、终端设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序操作指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序操作指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理终端设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理终端设备的处理器执行的操作指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序操作指令也可存储在能引导计算机或其他可编程数据处理终端设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的操作指令产生包括操作指令装置的制造品,该操作指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序操作指令也可装载到计算机或其他可编程数据处理终端设备上,使得在计算机或其他可编程终端设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程终端设备上执行的操作指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本申请实施例的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请实施例范围的所有变更和修改。
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者终端设备中还存在另外的相同要素。
以上对本申请所提供的一种基于分布式系统的灰度发布方法、客户端及平台进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。

Claims (19)

  1. 一种基于分布式系统的灰度发布方法,其特征在于,所述分布式系统包括多个相互独立的服务单元,每个服务单元用于为多种业务项目提供服务;所述服务单元包括源服务单元以及目标服务单元,所述源服务单元为未进行服务升级的服务单元,所述目标服务单元为已进行服务升级的服务单元;
    所述的方法包括:
    当客户端检测到针对目标业务项目的业务操作时,生成服务请求;其中,所述目标业务项目为在灰度发布过程中从源服务单元切换至目标服务单元的业务项目;
    确定与所述目标业务项目对应的目标服务单元;
    将所述服务请求发送至所述目标服务单元,所述目标服务单元用于依据所述服务请求为所述目标业务项目提供相应的服务,并生成服务响应信息;
    接收所述目标服务单元返回的服务响应信息。
  2. 根据权利要求1所述的方法,其特征在于,所述确定与所述目标业务项目标识对应的目标服务单元的步骤包括:
    客户端判断本地是否存在关系数据表,所述关系数据表存储所述分布式系统中所有服务单元与对应的业务项目的映射关系;
    若否,则将所述服务请求发送至预设的入口服务单元中,所述入口服务单元用于在第二关系数据表中查找所述目标业务项目标识,确定所述目标业务项目标识对应的目标服务单元标识,并判断所述目标服务单元标识与自身的标识是否一致,以及,根据所述判断结果生成响应信息返回客户端;所述响应信息包括判定所述目标服务单元标识与自身的标识一致时生成的第一响应信息;或者,判定所述目标服务单元标识与自身的标识不一致时生成的第二响应信息,所述第二响应信息包括所述第二关系数据表;所述第二关系数据表用于存储所述分布式系统中进行灰度发布后所有服务单元与对应的业务项目的映射关系;
    若是,则从所述关系数据表中查找所述目标业务标识,确定与所述目标业务项目标识对应的服务单元,并将所述服务请求发送至所述对应的服务单元,所述对应的服务单元用于在第二关系数据表中查找所述目标业务项目标识,获得所述目标业务项目标标识对应的目标服务单元标识,并判断所述目标服务单元标识与自身的标识是否一致,以及,根据所述判断结果生成响应信息返回客户端;所述响应信息包括第一响应信息或者第二响应信息;
    接收所述入口服务单元或所述对应的服务单元返回的响应信息,在所述响应信息为第一响应信息时,将所述入口服务单元或所述对应的服务单元确定为目标服务单元;在所述响应信息为第二响应信息时,在所述第二关系数据表中查找所述目标业务项目标识,获得与所述目标业务项目标识对应的目标服务单元标识,并根据所述目标服务单元标识确定对应的目标服务单元。
  3. 根据权利要求2所述的方法,其特征在于,所述第一关系数据表包括第一服务项目列表及第二服务项目列表,所述第一服务项目列表为所述源服务单元服务的业务项目的标识组成的列表,所述第一服务项目列表包括所述目标业务项目标识;所述第二服务项目列表为所述目标服务单元服务的业务项目的标识组成的列表;
    所述目标业务项目在灰度发布过程中从源服务单元切换至目标服务单元,采用如下方式:
    加载所述第一关系数据表;
    从所述第一关系数据表中查找所述第一服务项目列表,并将所述目标业务项目标识从所述第一服务项目列表中移除;
    从所述第一关系数据表中查找所述第二服务项目列表,在所述第二服务项目列表中添加所述目标业务项目标识;
    保存所述第一关系数据表,生成第二关系数据表;
    持久化保存所述第二关系数据表。
  4. 根据权利要求1或2或3所述的方法,其特征在于,所述客户端与所述服务单元通过远程过程调用协议RPC进行通信。
  5. 根据权利要求1所述的方法,其特征在于,还包括:
    展现所述服务响应信息。
  6. 一种基于分布式系统的灰度发布方法,其特征在于,所述分布式系统包括多个相互独立的服务单元,每个服务单元用于为多种业务项目提供服务,所述业务项目包括目标业务项目;所述服务单元包括源服务单元以及目标服务单元,所述源服务单元为未进行服务升级的服务单元,所述目标服务单元为已进行服务升级的服务单元;
    所述的方法包括:
    将所述目标业务项目从源服务单元切换至目标服务单元;
    通过所述目标服务单元接收客户端发送的服务请求,其中,所述服务请求为所述客户端检测到针对所述目标业务项目的业务操作时生成的请求;
    通过所述目标服务单元,依据所述服务请求为所述目标业务项目提供相应的服务,生成服务响应信息,并将所述服务响应信息返回所述客户端。
  7. 根据权利要求6所述的方法,其特征在于,在所述将所述目标业务项目从源服务单元切换至目标服务单元的步骤之前,还包括:
    当所述分布式系统启动时,所述多个服务单元从数据库中加载第一关系数据表,其中,所述第一关系数据表存储所述分布式系统中进行灰度发布前所有服务单元与对应的业务项目的映射关系。
  8. 根据权利要求7所述的方法,其特征在于,所述第一关系数据表包括第一服务项目列表及第二服务项目列表,所述第一服务项目列表为所述源服务单元服务的业务项目的标识组成的列表,所述第一服务项目列表包括所述目标业务项目标识;所述第二服务项目列表为所述目标服务单元服务的业务项目的标识组成的列表;
    所述将所述目标业务项目从源服务单元切换至目标服务单元的步骤包括:
    加载所述第一关系数据表;
    从所述第一关系数据表中查找所述第一服务项目列表,将所述目标业务项目标识从所述第一服务项目列表中移除;
    从所述第一关系数据表中查找所述第二服务项目列表,在所述第二服务项目列表中添加所述目标业务项目标识;
    保存所述第一关系数据表,生成第二关系数据表;
    持久化保存所述第二关系数据表。
  9. 根据权利要求8所述的方法,其特征在于,在所述通过所述目标服务单元接收客户端发送的服务请求的步骤之前,还包括:
    所述多个服务单元从数据库中加载所述第二关系数据表;
    通过预设的入口服务单元或从所述第一关系数据表中确定的与所述目标业务项目标识对应的服务单元,接收客户端发送的服务请求;
    通过所述入口服务单元或所述对应的服务单元在所述第二关系数据表中查找所述目标业务项目标识,获得所述目标业务项目标标识对应的目标服务单元标识;
    所述入口服务单元或所述对应的服务单元判断所述目标服务单元标识与自身的标识是否一致,以及,根据所述判断结果生成响应信息返回客户端;所述响应信息包括判定所述目标服务单元标识与自身的标识一致时生成的第一响应信息;或者,判定所述目标服务单元标识与自身的标识不一致时生成的第二响应信息,所述第二响应信息包括所述第二关系数据表;
    所述客户端用于接收所述入口服务单元或所述对应的服务单元返回的响应信息,在所述响应信息为第一响应信息时,将所述入口服务单元或所述对应的服务单元确定为目标服务单元;在所述响应信息为第二响应信息时,在所述第二关系数据表中查找所述目标业务项目标识,获得与所述目标业务项目标识对应的目标服务单元标识,并根据所述目标服务单元标识确定对应的目标服务单元。
  10. 根据权利要求6-9任一项所述的方法,其特征在于,所述服务单元通过远程过程调用协议RPC与所述客户端进行通信。
  11. 一种基于分布式系统的灰度发布客户端,其特征在于,所述分布式系统包括多个相互独立的服务单元,每个服务单元用于为多种业务项目提供 服务;所述服务单元包括源服务单元以及目标服务单元,所述源服务单元为未进行服务升级的服务单元,所述目标服务单元为已进行服务升级的服务单元;
    所述的客户端包括:
    服务请求生成模块,用于当检测到针对目标业务项目的业务操作时,生成服务请求;其中,所述目标业务项目为在灰度发布过程中从源服务单元切换至目标服务单元的业务项目;
    目标服务单元确定模块,用于确定与所述目标业务项目对应的目标服务单元;
    服务请求发送模块,用于将所述服务请求发送至所述目标服务单元,所述目标服务单元用于依据所述服务请求为所述目标业务项目提供相应的服务,并生成服务响应信息;
    服务响应信息接收模块,用于接收所述目标服务单元返回的服务响应信息。
  12. 根据权利要求11所述的客户端,其特征在于,所述目标服务单元确定模块包括:
    判定子模块,用于判断本地是否存在关系数据表,所述关系数据表存储所述分布式系统中所有服务单元与对应的业务项目的映射关系;若是,则调用第一发送子模块,若否,则调用第二发送子模块;
    第一发送子模块,用于将所述服务请求发送至预设的入口服务单元中,所述入口服务单元用于在第二关系数据表中查找所述目标业务项目标识,确定所述目标业务项目标识对应的目标服务单元标识,并判断所述目标服务单元标识与自身的标识是否一致,以及,根据所述判断结果生成响应信息返回客户端;所述响应信息包括判定所述目标服务单元标识与自身的标识一致时生成的第一响应信息;或者,判定所述目标服务单元标识与自身的标识不一致时生成的第二响应信息,所述第二响应信息包括所述第二关系数据表;所述第二关系数据表用于存储所述分布式系统中进行灰度发布后所有服务单元与对应的业务项目的映射关系;
    第二发送子模块,用于从所述关系数据表中查找所述目标业务标识,确定与所述目标业务项目标识对应的服务单元,并将所述服务请求发送至所述对应的服务单元,所述对应的服务单元用于在第二关系数据表中查找所述目标业务项目标识,获得所述目标业务项目标标识对应的目标服务单元标识,并判断所述目标服务单元标识与自身的标识是否一致,以及,根据所述判断结果生成响应信息返回客户端;所述响应信息包括第一响应信息或者第二响应信息;
    响应信息接收子模块,用于接收所述入口服务单元或所述对应的服务单元返回的响应信息,在所述响应信息为第一响应信息时,将所述入口服务单元或所述对应的服务单元确定为目标服务单元;在所述响应信息为第二响应信息时,在所述第二关系数据表中查找所述目标业务项目标识,获得与所述目标业务项目标识对应的目标服务单元标识,并根据所述目标服务单元标识确定对应的目标服务单元。
  13. 根据权利要求12所述的客户端,其特征在于,所述第一关系数据表包括第一服务项目列表及第二服务项目列表,所述第一服务项目列表为所述源服务单元服务的业务项目的标识组成的列表,所述第一服务项目列表包括所述目标业务项目标识;所述第二服务项目列表为所述目标服务单元服务的业务项目的标识组成的列表;
    所述目标业务项目在灰度发布过程中从源服务单元切换至目标服务单元,采用如下方式:
    加载所述第一关系数据表;
    从所述第一关系数据表中查找所述第一服务项目列表,并将所述目标业务项目标识从所述第一服务项目列表中移除;
    从所述第一关系数据表中查找所述第二服务项目列表,在所述第二服务项目列表中添加所述目标业务项目标识;
    保存所述第一关系数据表,生成第二关系数据表;
    持久化保存所述第二关系数据表。
  14. 根据权利要求11或12或13所述的客户端,其特征在于,所述客 户端与所述服务单元通过远程过程调用协议RPC进行通信。
  15. 根据权利要求11所述的客户端,其特征在于,还包括:
    展现模块,用于展现所述服务响应信息。
  16. 一种基于分布式系统的灰度发布平台,其特征在于,所述分布式系统包括多个相互独立的服务单元,每个服务单元用于为多种业务项目提供服务,所述业务项目包括目标业务项目;所述服务单元包括源服务单元以及目标服务单元,所述源服务单元为未进行服务升级的服务单元,所述目标服务单元为已进行服务升级的服务单元;
    所述的平台包括:
    切换模块,用于将所述目标业务项目从源服务单元切换至目标服务单元;
    第一服务请求接收模块,用于通过所述目标服务单元接收客户端发送的服务请求,其中,所述服务请求为所述客户端检测到针对所述目标业务项目的业务操作时生成的请求;
    服务响应模块,用于通过所述目标服务单元,依据所述服务请求为所述目标业务项目提供相应的服务,生成服务响应信息,并将所述服务响应信息返回所述客户端。
  17. 根据权利要求16所述的平台,其特征在于,还包括:
    第一关系数据表加载模块,用于在所述分布式系统启动时,所述多个服务单元从数据库中加载第一关系数据表,其中,所述第一关系数据表存储所述分布式系统中进行灰度发布前所有服务单元与对应的业务项目的映射关系。
  18. 根据权利要求17所述的平台,其特征在于,所述第一关系数据表包括第一服务项目列表及第二服务项目列表,所述第一服务项目列表为所述源服务单元服务的业务项目的标识组成的列表,所述第一服务项目列表包括所述目标业务项目标识;所述第二服务项目列表为所述目标服务单元服务的业务项目的标识组成的列表;
    所述切换模块包括:
    第一关系数据表加载子模块,用于加载所述第一关系数据表;
    标识移除子模块,用于从所述第一关系数据表中查找所述第一服务项目列表,将所述目标业务项目标识从所述第一服务项目列表中移除;
    标识添加子模块,用于从所述第一关系数据表中查找所述第二服务项目列表,在所述第二服务项目列表中添加所述目标业务项目标识;
    第二关系数据表生成子模块,用于保存所述第一关系数据表,生成第二关系数据表;
    保存子模块,用于持久化保存所述第二关系数据表。
  19. 根据权利要求18所述的平台,其特征在于,还包括:
    第二关系数据表加载模块,用于所述多个服务单元从数据库中加载所述第二关系数据表;
    第二服务请求接收模块,用于通过预设的入口服务单元或从所述第一关系数据表中确定的与所述目标业务项目标识对应的服务单元,接收客户端发送的服务请求;
    标识查找模块,用于通过所述入口服务单元或所述对应的服务单元在所述第二关系数据表中查找所述目标业务项目标识,获得所述目标业务项目标标识对应的目标服务单元标识;
    响应信息生成模块,用于通过所述入口服务单元或所述对应的服务单元判断所述目标服务单元标识与自身的标识是否一致,以及,根据所述判断结果生成响应信息返回客户端;所述响应信息包括判定所述目标服务单元标识与自身的标识一致时生成的第一响应信息;或者,判定所述目标服务单元标识与自身的标识不一致时生成的第二响应信息,所述第二响应信息包括所述第二关系数据表;
    所述客户端用于接收所述入口服务单元或所述对应的服务单元返回的响应信息,在所述响应信息为第一响应信息时,将所述入口服务单元或所述对应的服务单元确定为目标服务单元;在所述响应信息为第二响应信息时,在所述第二关系数据表中查找所述目标业务项目标识,获得与所述目标业务项目标识对应的目标服务单元标识,并根据所述目标服务单元标识确定对应的目标服务单元。
PCT/CN2016/096581 2015-09-02 2016-08-24 一种基于分布式系统的灰度发布方法、客户端及平台 WO2017036332A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510558043.6A CN106487863B (zh) 2015-09-02 2015-09-02 一种基于分布式系统的灰度发布方法、客户端及平台
CN201510558043.6 2015-09-02

Publications (1)

Publication Number Publication Date
WO2017036332A1 true WO2017036332A1 (zh) 2017-03-09

Family

ID=58186629

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/096581 WO2017036332A1 (zh) 2015-09-02 2016-08-24 一种基于分布式系统的灰度发布方法、客户端及平台

Country Status (2)

Country Link
CN (1) CN106487863B (zh)
WO (1) WO2017036332A1 (zh)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107179988A (zh) * 2017-05-15 2017-09-19 杭州时趣信息技术有限公司 一种软件项目迭代保障体系
CN107147651B (zh) * 2017-05-18 2020-07-31 深圳房讯通信息技术有限公司 一种灰度发布系统及其发布方法
CN108958900A (zh) * 2017-05-18 2018-12-07 腾讯科技(深圳)有限公司 一种任务发布方法和任务发布系统
CN107229566B (zh) * 2017-06-07 2020-04-07 携程旅游网络技术(上海)有限公司 用于soa服务转换语言保持功能一致性的方法及系统
CN109547544A (zh) * 2018-11-20 2019-03-29 北京千丁互联科技有限公司 内容发布方法及装置
CN111338668B (zh) * 2020-02-14 2022-05-10 支付宝(杭州)信息技术有限公司 用于实时计算中的代码升级的方法及装置
CN112286650A (zh) * 2020-11-04 2021-01-29 中国电力财务有限公司 分布式服务的发布方法和装置
CN113301168A (zh) * 2021-07-23 2021-08-24 浩鲸云计算科技股份有限公司 一种动态策略灰度发布引擎实现请求精准分流方法及系统

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103164202A (zh) * 2011-12-15 2013-06-19 深圳市腾讯计算机系统有限公司 一种灰度发布方法和装置
CN103176790A (zh) * 2011-12-26 2013-06-26 阿里巴巴集团控股有限公司 应用发布方法和系统
CN103888281A (zh) * 2012-12-21 2014-06-25 腾讯科技(北京)有限公司 服务器灰度升级方法、装置及相应的灰度升级服务器
CN104378304A (zh) * 2013-08-14 2015-02-25 腾讯科技(深圳)有限公司 灰度发布的控制方法、装置及系统

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103379138B (zh) * 2012-04-17 2016-04-13 深圳市腾讯计算机系统有限公司 实现负载均衡的方法及系统和灰度发布的方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103164202A (zh) * 2011-12-15 2013-06-19 深圳市腾讯计算机系统有限公司 一种灰度发布方法和装置
CN103176790A (zh) * 2011-12-26 2013-06-26 阿里巴巴集团控股有限公司 应用发布方法和系统
CN103888281A (zh) * 2012-12-21 2014-06-25 腾讯科技(北京)有限公司 服务器灰度升级方法、装置及相应的灰度升级服务器
CN104378304A (zh) * 2013-08-14 2015-02-25 腾讯科技(深圳)有限公司 灰度发布的控制方法、装置及系统

Also Published As

Publication number Publication date
CN106487863B (zh) 2019-05-07
CN106487863A (zh) 2017-03-08

Similar Documents

Publication Publication Date Title
WO2017036332A1 (zh) 一种基于分布式系统的灰度发布方法、客户端及平台
EP2866420B1 (en) Method and device for content synchronization
US8990243B2 (en) Determining data location in a distributed data store
JP5458308B2 (ja) 仮想計算機システム、仮想計算機システムの監視方法及びネットワーク装置
WO2017185961A1 (zh) 一种服务发现的处理方法及装置
CN106817432B (zh) 云计算环境下虚拟资源弹性伸展的方法,系统和设备
JP2017528809A5 (zh)
CN106059825A (zh) 一种分布式系统及配置方法
US20230006944A1 (en) Interoperable cloud based media processing using dynamic network interface
CN111064781A (zh) 多容器集群监控数据的采集方法、装置及电子设备
US11356534B2 (en) Function repository selection mode and signaling for cloud based processing
US20180349239A1 (en) High availability and disaster recovery system architecture
CN110012054B (zh) 一种基于联盟链网络的业务处理方法及系统
CN114448895B (zh) 一种应用访问方法、装置、设备及介质
US20100332532A1 (en) Distributed directory environment using clustered ldap servers
US10587680B2 (en) Efficient transaction level workload management across multi-tier heterogeneous middleware clusters
EP4369181A1 (en) Node for running container group, and management system and method of container group
CN111510480A (zh) 一种请求发送方法、装置以及第一服务器
CN114625566A (zh) 数据容灾方法、装置、电子设备及存储介质
CN111240760B (zh) 基于注册中心的应用发布方法、系统、存储介质及设备
US20150220380A1 (en) Dynamically determining an external systems management application to report system errors
WO2023029485A1 (zh) 数据处理方法、装置、计算机设备及计算机可读存储介质
US20200150972A1 (en) Performing actions opportunistically in connection with reboot events in a cloud computing system
US8583774B2 (en) Mapping meaningful hostnames
CN112799863B (zh) 用于输出信息的方法和装置

Legal Events

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

Ref document number: 16840761

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16840761

Country of ref document: EP

Kind code of ref document: A1