CN113347260A - Micro-service development method based on cloud environment - Google Patents

Micro-service development method based on cloud environment Download PDF

Info

Publication number
CN113347260A
CN113347260A CN202110641102.1A CN202110641102A CN113347260A CN 113347260 A CN113347260 A CN 113347260A CN 202110641102 A CN202110641102 A CN 202110641102A CN 113347260 A CN113347260 A CN 113347260A
Authority
CN
China
Prior art keywords
service
micro
environment
development environment
cloud
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110641102.1A
Other languages
Chinese (zh)
Inventor
刘圣质
刘沛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Easy Digital Technology Co ltd
Original Assignee
Guangzhou Easy Digital Technology Co ltd
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 Guangzhou Easy Digital Technology Co ltd filed Critical Guangzhou Easy Digital Technology Co ltd
Priority to CN202110641102.1A priority Critical patent/CN113347260A/en
Publication of CN113347260A publication Critical patent/CN113347260A/en
Pending legal-status Critical Current

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/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/46Interconnection of networks
    • H04L12/4641Virtual LANs, VLANs, e.g. virtual private networks [VPN]
    • 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/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context

Abstract

The basic idea of the invention is to solve the problem of complex development environment under the micro-service architecture by changing the data request route after opening the local development environment and the cloud environment. The method comprises the following implementation steps: s1, when the micro service in the local development environment is registered in the registration center of the cloud container environment, labeling the micro service in the local development environment to distinguish the micro service in the local development environment from the micro service in the cloud container environment, wherein the micro service in the local development environment and the micro service in the cloud container environment are two logically equivalent micro services; s2, when the micro service is developed, the local development environment sends out a service request to access the cloud container environment; when the gateway S3 and the remote call are used for service discovery, the micro service with the label is preferentially identified in the two logically equivalent micro services, and a correct route is made. Through the method, the development efficiency can be effectively improved.

Description

Micro-service development method based on cloud environment
Technical Field
The invention relates to the technical field of computers, in particular to the field of micro-service development, and particularly relates to a micro-service development method based on a cloud environment.
Background
As the mobile internet matures and the industrial internet platforms serving the manufacturing industry became more and more popular, system development was gradually split from the original monolithic architecture of business services into multiple microservice applications consisting of many loosely coupled and independently deployable smaller components or services. Under the micro-service architecture, the system development has the advantages of easier development and maintenance, fast starting of single service, unlimited technology stack and the like. However, as the number of micro service applications increases dramatically, the problems caused by the micro service applications also become more and more obvious, and the development environment local to the developer also faces the same problems due to the complicated configuration, the higher cost of operation and maintenance, and the complicated and complicated dependence among the micro service applications. Because of the complexity of the development environment brought by the microservice architecture, developers need to spend a great deal of time and effort maintaining the development environment, including other microservices, database resources, other integrated system environments, and underlying sample data, etc. on which the microservice being developed depends.
From the developer's perspective, the entire system can be divided into two parts: services are under development, and services are being developed. The developing part generally runs in an Integrated Development Environment (IDE), which is convenient for developers to debug; the development dependent part is only easy to be concocted with the part under development. In response to the complex development environment problem under the micro-service architecture, the existing solutions include the following:
and firstly, all the services run locally, namely all the services are woven in a docker-compound file, and all the services are started locally. The dependency may be configured by port mapping from the developing run on HOST. The method has the advantages of simplicity and easiness in development, but the local configuration environment is very complex, a large amount of time and energy are needed to maintain the development environment, as the services are more and more, the storage of a large amount of local data, sample data, part of configuration data and the like has extremely high requirements on the configuration of the local server, and dozens of services cannot bear the requirement when running together.
And secondly, all the services run in the cloud, namely all the services are deployed in the cloud, and the developing part is also deployed in the cloud for remote joint debugging. The method solves the problems of complex local configuration environment and difficult data storage, but for development, the complex dependent pointing cannot quickly locate the micro-service to be called and debugged, which brings about the problem of difficult remote calling and debugging.
And thirdly, part of the services are operated at the local or web end, and part of the services are operated at the cloud end, namely, the services under development and the services sending requests to the services under development are placed at the local/web end, and the rest of the services are operated at the cloud end. Referring to fig. 1, for example, a developer needs to develop a service B, and the data flow is service a → service B → service D → service E, then both the service a sending a request to the developing service and the developing service B need to be in the local, and the rest of the services, such as service D and service E, can be deployed in the cloud. This is a relatively compromised method, and is also a method used by most micro-service development, but when the number of services sending requests increases and the complexity increases, the problem of storage difficulty of a large amount of local data, sample data, and part of configuration data also occurs, and meanwhile, the local service cannot be shared with other developers, such as the service a [1] in the above example.
In order to improve the existing solutions, it is necessary to invent a micro-service development method based on a cloud environment, so as to solve the difficulty that the development environment is complex and needs to spend a lot of time for maintenance, thereby improving the development efficiency and the simplicity.
Disclosure of Invention
The invention provides a micro-service development method based on a cloud environment, which aims to solve the problem that the development environment under a micro-service architecture is complex, comprises the steps of insufficient local server configuration, difficult remote debugging and incapability of sharing the service of a sending request, and changes the routing of a data request after opening the local development environment and the cloud environment.
In order to achieve the above object, the invention provides a micro-service development method based on a cloud environment, wherein a cloud has mutually isolated namespaces (namespaces), and a developer has a set of own micro-service development environment, namely a cloud container environment, in the namespaces; and network segment intercommunication is established through a VPN tool, and the cloud container environment network and the local development environment are communicated.
The method comprises the following steps:
s1, when the micro-service in the local development environment is registered in the registration center of the cloud container environment, distinguishing the micro-service of the local development environment and the micro-service of the cloud container environment by a method of labeling the micro-service in the local development environment, wherein the micro-service of the local development environment and the micro-service of the cloud container environment are two logically equivalent micro-services;
s2, when the micro service is developed, the local development environment sends out a service request to access the cloud container environment, wherein the service request comprises a micro service label;
when the S3 gateway and the remote call are used for service discovery, the micro service with the label is preferentially identified in the two logic peer micro services, and a correct route is made:
if the tagged micro-service is identified in the local development environment and the cloud container environment, the service request is preferentially forwarded to the micro-service with the tag in the environment;
if no tagged microservices are identified in the local development environment and the cloud container environment, the service request is forwarded to a default microservices in the environment.
The method for identifying the micro-service with tag includes, but is not limited to, the following methods:
introducing the compiled public program package into all the micro services of the local development environment and the cloud container environment, and running the public program package in the micro services, wherein the compiled public program package can acquire and identify a micro service label of a service request; or
Identified by Sidecar mode (Sidecar pattern) within the microservice container: and when a service request is sent out, the side car agent acquires and identifies the label to determine the routing direction, and the micro service code and the function are not influenced.
Alternatively, the label in the above method may be any character, including but not limited to tag.
Alternatively, the tags in the above methods may exist in a variety of forms, including but not limited to placement in a browser cookie, specifying an HTTP header (HTTP header) request, submission as a parameter request.
Optionally, in the method, a manner of distinguishing between the micro service tagged in the local development environment and the micro service in the cloud container environment further includes adding an attribute to distinguish between the two logically equivalent micro services when the registry registers the micro service.
It should be noted that the micro-services are differentiated in a manner of adding attributes
Optionally, the two logically equivalent microservices in the above method, namely the microservices of the tagged local development environment and the microservices of the cloud container environment, may contain different codes, and the code of the tagged microservices in the local development environment is continuously modified according to the development requirement.
Compared with the prior art, the invention has the following innovation points:
1. according to the method, only the micro-service under development is kept in the local environment, and the rest of micro-services are operated in the cloud, so that the complexity of the micro-service development environment is reduced, the local environment configuration is relatively simple, the problem that the local sample data, part of the configuration data and the like are difficult to store is solved, a large amount of time is not needed to be spent for maintaining the development environment, and the development efficiency is improved.
2. According to the method for marking the micro-service, the flow direction of the request data can be quickly positioned during service searching, and compared with the environment of a cloud end relative to a black box, the method can improve the accuracy and the development efficiency.
3. According to the method, the micro-service under development is deployed in the local environment, and the rest of the micro-services which are not changed are still kept in the cloud environment, so that the cloud micro-service or the micro-service codes and functions under use can be prevented from being influenced by development.
4. According to the method and the device, the micro-services which need to be depended on by the current micro-service development are kept in the cloud environment, and compared with the mode that the micro-services which need to be depended on by the micro-service development in the prior art are stored in the local, developers can reuse the micro-services kept in the cloud environment, the possibility of cooperative work is improved, and the development efficiency is improved.
Drawings
Other embodiments of the present application will become apparent by consideration of the following detailed description of non-limiting embodiments with reference to the accompanying drawings
The features, objects and advantages will become more apparent:
fig. 1 is a diagram of abstracted dependencies between services in the prior art, and arrows represent data flow.
FIG. 2 is a schematic diagram of a namespace described in an embodiment in accordance with the invention.
Fig. 3 is a schematic diagram of the steps of the method in an embodiment according to the invention.
Fig. 4 is a data routing diagram of the method in an embodiment in accordance with the invention.
Fig. 5 is a schematic diagram of a method for acquiring a micro-service identifier according to an embodiment of the present invention.
Fig. 6 is a schematic diagram of another method for acquiring a microservice identifier in an embodiment in accordance with the invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
The basic idea of the invention is to solve the problem of complex development environment under the micro-service architecture by changing the data request route after opening the local development environment and the cloud environment.
Example one
The embodiment is an actual scene for developing micro-service b (service b) and micro-service c (service c), wherein, as shown in fig. 2, the cloud has mutually isolated namespaces (namespaces), and a developer has a set of own micro-service development environment, namely a cloud container environment, in its own namespace; and establishing a local development environment through a VPN tool to be communicated with respective name space network segments, and communicating the cloud container environment network with the local development environment.
As shown in fig. 3, the method includes the following steps:
s1, when a micro service B and a micro service C in a local development environment are registered in a registration center of a cloud container environment, tags are added in front of names of the micro services to distinguish the micro services of the local development environment and the cloud container environment, namely, the micro service B is tag-serviceB in the local development environment, the default service in the cloud container environment is serviceB, similarly, the micro service C is tag-serviceC in the local development environment, and the default service in the cloud container environment is serviceC, wherein the micro services in the local development environment and the micro services in the cloud container environment are two logically equivalent micro services, namely, the tag-serviceB and the serviceB are two logically equivalent micro services, and the tag-serviceC and the serviceC are two logically equivalent micro services;
s2, when developing the micro service B and the micro service C, starting tag-service B and tag-service C from a local IDE, and sending a service request to access the cloud container environment by the local development environment, wherein the service request comprises a micro service label tag;
when the S3 gateway and the remote call are used for service discovery, the micro service with tag is preferentially identified in the two logic peer micro services, and a correct route is made:
if the tagged micro-service is identified in the local development environment and the cloud container environment, the service request is preferentially forwarded to the micro-service with the tag in the environment, namely tag-service B and tag-service C;
if no tagged micro-service is identified in the local development environment and the cloud container environment, the service request is forwarded to default micro-services in the environment, namely serviceA, serviceD and serviceE;
with reference to fig. 4, when developing the micro service B or the micro service C, the developer changes from the route serviceA → serviceB → servicec → serviceD → serviceE originally called according to the inter-service logic to the route for preferentially identifying the micro service with tag according to the above rules, and the route actually called between services is as follows:
serviceA→tag-serviceB→tag-serviceC→serviceD→serviceE。
in the method, the micro-service with tag is preferentially identified, and the following method can be used:
referring to fig. 5, introducing a compiled jar packet (public program packet) into all the microservices of a local development environment and a cloud container environment, and running the microservices, referring to fig. 5, taking serviceA as an example, introducing a jar packet into serviceA, acquiring the microservices with tags in the environment, and determining that a route points to tag-serviceB; or
As shown in fig. 6, the identification is performed in the microservice container by Sidecar mode (Sidecar pattern): when a service request is sent to the serviceA, the sidecar agent in the container A can obtain the micro service with tag in the environment, namely tag-serviceB, and determine that the routing points to tag-serviceB, so that the code and function of the serviceA are not affected.
Alternatively, the tag in the above method may be any other character.
Alternatively, the tag in the above method may exist in various forms, including being placed in a browser cookie, specifying an HTTP header (HTTP header) request, or being submitted as a parameter request.
Optionally, in the method, a manner of distinguishing a tag-service in a local development environment from a service in a cloud container environment further includes adding an attribute to distinguish two logically equivalent microservices when registering the microservices in the registry.
Optionally, the two logically equivalent micro services in the above method, i.e., tag-service b and service b, tag-service c and service c, may include different codes, and if a developer needs to change the codes when the developer is locally started, the tag-service b and tag-service c codes in the local development environment are continuously modified due to development requirements, and the codes of the service b and service c in the cloud container environment are different.
The embodiments described above are exemplary descriptions of the present invention, and it is obvious that the specific implementation of the present invention is not limited by the above-mentioned manner and the above-mentioned fields and forms, and it is within the protection scope of the present invention as long as various insubstantial modifications are made by using the method concept and technical scheme of the present invention, or the concept and technical scheme of the present invention is directly applied to other occasions without modifications.
Reference to the literature
[1] CSDN blog development environment problem under micro service architecture, China https:// blog.csdn.net/goodmancec/article/details/82119302

Claims (5)

1. A micro-service development method based on cloud environment, wherein,
the cloud has mutually isolated namespaces (namespaces), and developers have a set of own micro-service development environment, namely a cloud container environment, in the namespaces;
establishing network segment intercommunication through a VPN tool, and communicating a cloud container environment network and a local development environment of each network segment intercommunication;
the method is characterized by comprising the following steps:
s1, when the micro-service in the local development environment is registered in a registration center of a cloud container environment, distinguishing the micro-service of the local development environment from the micro-service of the cloud container environment by a method of labeling the micro-service in the local development environment, wherein the micro-service of the local development environment and the micro-service of the cloud container environment are two logically equivalent micro-services;
s2 when developing the micro service, the local development environment of step S1 issuing a service request to access the cloud container environment of step S1, wherein the service request includes micro service tag information;
when the gateway of S3 and the remote call are used for service discovery, the micro service with the tag is preferentially identified in the two logically equivalent micro services of step S1, and the correct route is made:
if the tagged micro-service is identified in the local development environment and the cloud container environment of the step S1, the service request of the step S2 is preferentially forwarded to the micro-service with the tag in the environment;
if no tagged micro-service is identified in the local development environment and cloud container environment of step S1, the service request of step S2 is forwarded to a default micro-service in the environment.
2. The method according to claim 1, wherein the label in step S1 can be any character.
3. The method of claim 1, wherein the tag in step S1 can exist in various forms, including but not limited to being placed in a browser cookie, specifying an HTTP header (HTTP header) request, or being submitted as a parameter request.
4. The method of claim 1, wherein the step S1 distinguishes between the tagged microservice in the local development environment and the microservice in the cloud container environment, further comprising adding an attribute to distinguish between the two microservices of the logical peer when registering for microservices at the registry of step S1.
5. The method according to claim 1, wherein the two micro services logically equivalent in step S1, namely the micro service of the tagged local development environment and the micro service of the cloud container environment, comprise different codes, and the tagged micro service code in the local development environment is modified continuously according to development requirements.
CN202110641102.1A 2021-06-09 2021-06-09 Micro-service development method based on cloud environment Pending CN113347260A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110641102.1A CN113347260A (en) 2021-06-09 2021-06-09 Micro-service development method based on cloud environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110641102.1A CN113347260A (en) 2021-06-09 2021-06-09 Micro-service development method based on cloud environment

Publications (1)

Publication Number Publication Date
CN113347260A true CN113347260A (en) 2021-09-03

Family

ID=77475626

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110641102.1A Pending CN113347260A (en) 2021-06-09 2021-06-09 Micro-service development method based on cloud environment

Country Status (1)

Country Link
CN (1) CN113347260A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110251992A1 (en) * 2004-12-02 2011-10-13 Desktopsites Inc. System and method for launching a resource in a network
CN103401897A (en) * 2013-07-15 2013-11-20 云南电网公司普洱供电局 Method for constructing distributed service registration center
CN109547570A (en) * 2018-12-29 2019-03-29 深圳云天励飞技术有限公司 Service registration method, apparatus, registration center's management equipment and storage medium
US20210135983A1 (en) * 2019-10-30 2021-05-06 Kabushiki Kaisha Toshiba Service request routing

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110251992A1 (en) * 2004-12-02 2011-10-13 Desktopsites Inc. System and method for launching a resource in a network
CN103401897A (en) * 2013-07-15 2013-11-20 云南电网公司普洱供电局 Method for constructing distributed service registration center
CN109547570A (en) * 2018-12-29 2019-03-29 深圳云天励飞技术有限公司 Service registration method, apparatus, registration center's management equipment and storage medium
US20210135983A1 (en) * 2019-10-30 2021-05-06 Kabushiki Kaisha Toshiba Service request routing

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李永进等: "面向高并发复杂民航业务的服务器架构设计", 《计算机应用与软件》 *

Similar Documents

Publication Publication Date Title
CN109933522B (en) Test method, test system and storage medium for automatic case
JP4777634B2 (en) Context-aware automatic service discovery and execution engine in mobile ad hoc networks
CN109902105B (en) Data query system, method, device and storage medium for micro-service architecture
RU2648966C2 (en) Apparatus and method for processing multiple open api
US20080028068A1 (en) Method and system to adaptively manage the quality of service of interactions between smart item networks and enterprise applications
CN110377438A (en) The method for routing of striding course communication interface, device and system
JP2010503905A (en) Discovery web service
CN110912782B (en) Data acquisition method, device and storage medium
US8286194B2 (en) Coupling state aware systems
CN110581893B (en) Data transmission method and device, routing equipment, server and storage medium
CN112383533A (en) Message format conversion method and device
WO2022127196A1 (en) Application identification method and apparatus, and device and storage medium
Chen et al. Introduction to OPNET network simulation
CN111506305B (en) Tool pack generation method, device, computer equipment and readable storage medium
CN113347260A (en) Micro-service development method based on cloud environment
CN111966718A (en) System and method for data propagation tracking of application systems
CN111158777A (en) Component calling method and device and computer readable storage medium
CN111488144A (en) Data processing method and equipment
CN114201314B (en) Contract-based routing method for realizing service dependency discovery and service access
CN114253739A (en) Service calling method and device, electronic equipment and storage medium
CN103823827A (en) Method and device for crawling rich internet applications
CN114490318A (en) Environment management system and method for realizing weak isolation based on bytecode enhancement
CN110555042B (en) Method, device and system for retrieving data in real time
CN109388400B (en) Automatic page generation method and device
CN117632445B (en) Request processing method and device, task execution method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20210903

WD01 Invention patent application deemed withdrawn after publication