Based on the container cloud micro service
the birth of micro service architecture and the popularity of container technology, is almost at the same time, it is no accident, but the age of the Internet change as a result of the reversed transmission technology and traditional architecture, and represented by Docker container technique for the realization of the micro service idea provides the matching mechanism, the author from what is micro service cuts, detailed introduces the advantage of micro service architecture, from their own practice, finally gives the micro service architecture of the cloud.
The following is the original:
In recent years, much attention has been paid to micro service architecture and container technology, has appeared in all kinds of articles, speeches, blogs, and become the industry's most popular topic.In the fashion vocabulary and passion behind the full discussion, people began to seriously rethink the age of the Internet service architecture and application development, operational methods.Micro service to an entirely new architecture design pattern, affects the Internet application of the whole process from design to operational methodology change.While represented by Docker container technology for the realization of the micro service idea provides the matching mechanism, which is followed by the substantial change of a new generation of application development and release.
What is a micro service architecture?
Micro service Architecture (Microservices Architecture) is a kind of Architectural Style, Architectural Style) and design patterns, advocate the application will be divided into a series of small services, each service focus on a single business function, running in a separate process, the boundary between services is clear, using lightweight communication mechanism (such as HTTP/REST) to communicate with each other and cooperate to achieve complete applications, business and user needs.
Micro services as architectural patterns change, its birth is no accident.It is when confronted with challenges in the era of Internet, traditional service structure in architectural patterns, a reflection of the development and operational methodology.So, before the probe micro service architecture, we first review the traditional service architecture is more prevalent.
Traditional "single block architecture" :
Over the past 10 years, or even micro service has become increasingly popular at present, most applications use is still we are more familiar with traditional Architecture, called "Monolithic Architecture (Monolithic Architecture)" mode.Such architecture systems typically layered with technology, such as one of the most common "layered architecture" in the presentation layer, business logic layer and data layer.While business logic according to the business of more specific duties, function modular, form a logical component.Need to mention here is that "layered architecture", although there is a logical modules and components, but the physical deployment architecture level is still a "single", usually as a whole compilation, packaging, deployment, and operations."Single block architecture" is from the perspective of physical deployment, for applications, including "layered architecture", a definition of architectural pattern.
"Layered architecture" is the classic mode in software architecture system, is also a long time to application architecture DE facto standard.Also has its advantage and monolithic architecture, embodied in:
1. Convenient for development: a large number of commonly used integrated development
environment (IDE) and the programming framework (such as Rails, Django) are around traditional
architecture order of application design.These tools for developers to provide a convenient and
familiar development, debugging experience.
2. Facilitate testing: because the entire application is contained in a process, in conjunction with the
commonly used tools application can easily start in the development and test environment.Then use
the UI automation tools (such as Selenium) can be simple implementation End - to - End test.
3. Easy to deploy: most programming languages and frameworks have a particular application
packaging format.Only copies of a single package to running environment deployment.This
process can also be through the existing automation tools.
Due to these advantages, at the beginning of the project, the monolithic structure has a certain appeal.Developers can quickly generate application prototype tool, framework, without having to spend a lot of energy on the service decomposition and distributed architecture design.But with the expansion of business and function, the accumulation of original simple applications quickly become bigger volume, the monolithic architecture is difficult to meet the requirement of rapid change, due to the limitations on the level of architecture, this kind of application will face multiple challenges.
1. Low development efficiency: with the increase of application complexity, fewer and fewer
developers can have on the application of the depth of the global understanding.The development
of new function and defect repair difficulty increase geometry.The correctness of the code changes
can't guarantee.And huge code base need to be more big development team to maintain, virtually
and add the cost of management, communication and coordination.In addition, the new team
members need to spend a lot of time and energy to become familiar with a complex code base.
2. Long delivery period: within a single process under the single block architecture of any minor
changes need to recompile, integration, testing, and deployment of the entire application.With the
increase of application volume, delivery process and feedback cycle will be longer accordingly,
application of cost also will increase.So slow application delivery cycle, and delivery clearance
code changes increase of accumulation, thus produces more pressure for the next delivery, form a
3. Difficult technical transformation: a single process, single piece of architecture means centralized
technology selection.For example, the application of different logical form usually requires
relatively unified programming language, framework and technology stack.The initial stage in the
project has already set.Even after application of a new logical components, also it is difficult to use
different technology stacks.And when the application after reaching a certain size, global
technology stack update will face high risk.So, monolithic application once finalize the design,
architecture is hard to enjoy the changes in the industry, the development of dividends.
As a result of the existence of these structural and systemic problems, the application of single block architecture become more and more difficult to adapt to the age of the Internet fast change of market demand.Micro service is starting from the architecture level, promote change in the way traditional application development, operations, and help enterprises to quickly response to market demand, rapid iteration, fast delivery, to stay competitive in the Internet age.
The advantage of micro service architecture:
In micro service framework, we will the original single application according to the function of micro boundary is decomposed into a series of separate, dedicated service.Each micro service corresponding to the traditional application of a component, but it can compile, deploy and expand independently.Relative single piece of architecture, the service has the following advantages.
1. Complexity control: the application of decomposition at the same time, avoid the complexity of
endless accumulation.Each service focus on a single function, and through a well-defined interface
clear service boundaries.Due to the small size, low complexity, each service can be developed by a
small team full control, easy to maintain a high maintainability and efficiency of development.
2. Independent deployment: due to micro service independently running processes, so each service
can be deployed independently.When a micro service change without having to compile, deploy
the whole application.Composed of micro service application is equivalent to a series of parallel
release process, make more efficient, reduce the risk of production environment at the same time,
eventually shorten delivery cycle.
3. Technology selection flexible: micro service architecture, technology selection is
decentralized.Each team can according to their own service demand and the development of the
industry status quo, the freedom to choose the most suitable technology stack.Because each service
is relatively simple, when you need to upgrade technology stack when facing the risk is low, even
completely refactoring a micro service is feasible.
4. Tolerance: formed when a fault occurs, in a single process, under the traditional architecture of
fault is likely to spread in the process of application form global is not available.Under the micro
service architecture, fault can be isolated in a single service.If well designed, other services can be
realized through retry, smooth degradation mechanisms such as the application layer of the fault
5. Extension: monolithic application architecture can also realize the horizontal extension, is to apply
the full copy to a different node.When the application of different components of the differences on
expanding demand, micro service architecture reflects its flexibility, because each service can be
extended according to the actual demand independently.
Micro service architecture of the cloud:
The micro service architecture brings many advantages, but it must be admitted that build, deployment and maintenance of distributed micro service system is not easy.And container provided by lightweight, application oriented service virtualization environment as to provide the ideal carrier.Similarly, cloud services based on the technology of container will greatly simplify the container micro service creation, integration, deployment and operations of the entire process, so as to promote the tiny segment cloud mass practice.The following finches cloud in spirit, for example, to illustrate the process of practice:
1. Create: spirit finches cloud image building and continuous integration services to help users will be independent and reusable service package, mirror into the container ready to be deployed.Assumes that users of the service procedures, stored in a lot of code hosting service, the user can put this code warehouse building into a container, mirror image and stored in the warehouse, the user can be a key to the micro service deployed in our container cloud platform.Spirit at the same time, the finches provides the function of continuous integration of cloud, the user can choose whether to use.When a change in the code of micro service, I have to build a new container mirror, used for later deployment.
2. Integration: the platform is not only in the mirror warehouse platform brings together a large number of high-quality images from Docker officials and communities, and also any mirror source outside support platform.The user can free combination and reuse of tens of
thousands of container micro service, easy integration application like building blocks.For example, users need to a generic MySQL database services, he need not build a mirror, can be in directlyImage communitySelect the appropriate database service image, and micro service link up with them.