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.
3. Deploy: micro service due to component quantity is numerous, the cloud deployment become a difficulty in practice.Spirit finches cloud to container released for the application of the carrier, the user does not have to specify the deployment of traditional way of cumbersome steps, only need to provide containers mirror and simple configuration, the platform will turn the whole deployment process automation.In addition, the platform also compatible with docker - compose, implementation for composed of multiple micro service container complete application deployment of a key.
4. Ops: micro service because many independent process after deployment operations, management into practice on another difficulty.Spirit finches cloud completely block the underlying cloud hosting and infrastructure operations, allow the user to focus on the application.At the same time, through the container layout, auto repair, auto monitoring and extend advanced application lifecycle services such as log, micro intelligent hosting service, realizing the container further help users reduce the operational cost and difficulty.
5. Network: micro service framework between the components of communication, coordination has higher requirements to the network, especially in the practice of the cloud, the physical location of micro service component is dynamic, and is not controlled by the application.Spirit finches cloud network solutions provide full container, support load balancing, service discovery, across the host, and application security network to ensure that the service availability and security of the internal and external network.
; First of all, to realize the high availability of services, the load balancer is indispensable, spirit
finches cloud support based on the transport layer and application layer of the load balance, to meet
different customers' needs.
; Load balancing can also implement the service discovery, the deployment of the cloud services, the
physical location of each component deployment is likely to change.In spirit finches cloud, when
the user to create a micro service, regardless of this service is stopped or running state, we will
create the load balancer for service and a domain name, so other services can pass the domain
name to access the service.Even in the service container instance is migrated, the system will be in
it after the restart, to mount it back to the original load balancer.
; Across the host, is refers to the micro service instances of container will be deployed in different
cloud host, but it would be associated with the service load balancer, to request service from the
network or the network.
; Internal service address, micro service for many applications, it is a very important function, such
as in an application, a micro service needs to access a cache server (memcached, for example), but
for security reasons, do not want the external request access to the cache server, you can use the
spirit finches cloud internal service address.Systems will also create a load balancing, and domain
name, but the domain name will be used solely for the user's other service access, external
application, or other user service is inaccessible.
; Dedicated IP is spirit finch recently added a function of cloud, some users due to the special
requirement, do not want to and other users to share the IP, can apply for a dedicated IP, and bind
on their applications, in order to obtain better isolation.
6. Storage: micro service promote diversity Persistence (Polyglot Persistence), the application can choose according to the actual demand of each service within the most appropriate data services.Micro service generally divided into two classes, stateless and stateful services, stateless service such as application servers, they are usually not save the data, convenient lateral extension.Stateful services need to store data, such as a database service, the cache service.Docker features, determines the data of the container itself is not persistent, need by mounting the Volume to realize data storage.Spirit finches cloud will persistence cloud storage into abstract data volume, can be directly mounted on the container, and the container automatically restart, migration to mount.Can support data services, and any
container for micro service application integration.At the same time, the support of service data backup, restore, and download, can be used to recover data backup at any time.
The birth of micro service architecture and the popularity of container technology, is almost at the same time, this is not an accident.This is the age of the Internet change as a result of the reversed transmission technology and traditional architecture, the forefront of the developers and their Internet companies are the first to feel the change.Spirit finches YunXiWang and developers together leading this change, help Internet companies really focus on their core business, and keep ahead in technology and architecture.