Micro-services practice: What is micro service

Micro-services practice: What is micro service

Micro Services

   Micro service is a software architecture style, the word comes from Martin Fowler  's blog post. He elaborated micro-services six characteristics in his blog

  • A group of small service. Micro-services advocates the monomer units a service application into small apart of .
  • Based on operational capacity . Such as shopping sites, you can have orders for services, goods and services, recommended services.
  • Micro service runs in a separate process . Techniques such as the current container, the container can be deployed on a physical machine, so as to extend transversely process.
  • Lightweight communication mechanism . For example, the HTTP protocol & JSON message format.
  • Independent deployment . Each team independently deploy their own micro-services, it does not require much coordination between the special team to improve system capacity and iterative business support capabilities.
  • No centralized management . The original architecture requires a unified technology stack, storage, micro-service claims each service according to their actual situation, choose the right technology stack and storage.

 

The wheel of history

Early days

  We started an online supermarket business projects, for security reasons, to separate the shopping site and management background, its structure is as follows:

  

  After the code is done quickly, find a home on the line to deploy cloud services, began on his own.

 Scale

  After the expansion of the scale, in order to expand customer channels, in addition to the website, also developed a mobile terminal APP, small micro-channel programs, etc. In addition, it has added some new marketing tools, such as promotional activities, precision marketing and so on. The upgraded infrastructure as follows:

  

  At this stage there are many unreasonable:

  • Sites and many of the same mobile client application business logic code duplication.
  • Sometimes the data through the database to share, sometimes through the interface call transfer. Cluttered interface call relationship.
  • A single application to provide an interface to other applications, the greater the change more gradually, comprising a number of logic should not belong to it. Application of fuzzy boundaries, ownership of functionality confusion.
  • Management background to protect lower level in the beginning of the design. Performance bottlenecks After adding data analysis and campaign management-related functions, affecting other applications.
  • Database table structure is dependent on a plurality of applications, it can not be reconstructed and optimization.
  • All applications in a database operation, database performance bottlenecks. Especially when running up the data analysis, database performance dramatically.
  • Development, testing, deployment, maintenance more difficult. Even if only a small change function, but also need to publish the entire application together. After the conference, sometimes accidentally put some untested code, or modify a feature, another unexpected went wrong. In order to mitigate the impact of the release and the possible effects of online business stalled, all applications have to perform three or four in the morning release. After the release order to verify the application of the normal operation, the user had to stare into the next peak of the day ......
  • Team appear buck-passing phenomenon. Questions about some of the common functionality should be built on which applications often have to argue for a long time, the last or simply do all, or just put a place but not maintenance.

make change

  In the programming world, the most important is the ability to abstract, organize by business logic, early abstract public service capabilities, made several public service. Just these services from various applications to obtain the required data, thus a large number of deleted redundant code, gave birth control layer and a thin front end, this stage structure is as follows:

  

  

 

 

  This stage there are still many shortcomings:

  • Database performance bottleneck, and there is the risk of a single point of failure.
  • Data management tend confusion, there may be a service calls another service data directly from the database of the phenomenon.
  • Database table structure may be more dependent on services, indeed affect the whole body, it is difficult to adjust.

  Later, the big bang, to split the database, all persistence layer isolated from each other, the responsibility of the individual services. In addition, in order to improve real-time, adding a message queue mechanism.

  

  After each service can be completely split heterogeneous technology adoption. Such as data analysis services can use the data warehouse as the persistence layer, in order to efficiently do some statistical calculations; goods and services and promotional services access frequency is relatively large, and therefore joined the caching mechanism.

Mature

  

 

 

 

 

 

 

 

 

Original link: https://www.cnblogs.com/skabyy/p/11396571.html

 

Guess you like

Origin www.cnblogs.com/MrSaver/p/11441984.html