当前位置:网站首页>From monomer structure to microservice architecture, introduction to microservices

From monomer structure to microservice architecture, introduction to microservices

2022-07-06 07:59:00 Frog at the bottom of the well

Monomer architecture VS Microservice architecture

1.1 Starting from the single architecture

One project corresponds to one archive package (war), This war package The work of the project includes all the work
can . We become this application as a monomer application , That is what we often call monomer architecture ( One
war try to do everything all by oneself ).

A detailed description : It's in one of our war In bag , It gathers various functions and resources , such as JSP、JS、CSS、HTML etc. .
The business includes our user module , Order module , Payment module and so on .

Single structure diagram

 Single structure diagram

1.3 Summary of advantages and disadvantages of monomer structure

advantage :
  • Simple and clear architecture , No, ” tart “ The problem needs to be solved .
  • Development , test , Simple deployment ( Especially the operation and maintenance personnel You'll wake up laughing when you're asleep )
shortcoming :
  • As the business expands , The code is getting more complicated , The quality of the code is uneven ( The level of developers varies ), Will let you submit code every time , Modify every little bug All are heart startling and gallbladder trembling -- be deeply Of .
  • Slow deployment ( Due to the monomer Architecture , Complex functions ) Imagine the next one coming from 200W+ The speed of code deployment .
  • High expansion cost , According to the monomer architecture diagram Suppose the user module is a CPU intensive Module ( It involves a lot of operations ) So we need to replace something more powerful CPU, And our order module is a IO Dense modules ( It involves a lot of reading and writing disks ), Then we need to replace more powerful memory and efficient disks . But in our monomer Architecture Cannot be extended for a single function module , Then you need to replace something more powerful CPU More powerful memory Better disks The price goes up slowly .
  • Hindering the development of new technology … Like our web Architecture module from struts2 Migrate to springboot, Then it will become disastrous

2、 Microservices and microservice architecture

2.1 Definition of microservices

The core of microservice is to integrate the traditional stand-alone application , Separate stand-alone applications into one by one according to business service , Complete decoupling , Each service provides a specific function , A service does only one thing , Similar process , Every service can Separate deployment , You can even own your own database . Such a small service is Microservices .

  • For example, traditional stand-alone e-commerce applications , A mall system has Order / payment / stock / logistics / integral Equal module ( Understood as a servcie)

  • We according to the business model To split , It can be divided into Order service , Payment services , Inventory service , Logistics services , Points service

If you don't split it , My non core business points module There's something big bug Cause system memory overflow , Cause the whole system to go down .
If after splitting , It's just that my point and micro service is not available , The core function of my whole system is still Be able to use .
 Insert picture description here

A big man has a good summary of the definition and understanding of microservice , Here I just quoted some simple language to understand microservices , For more information, please refer to the boss blog :http://blog.cuicc.com/blog/2015/07/22/microservices/

2.2 Expansion of stand-alone architecture and microservice

// To be continued , Have time to continue writing

原网站

版权声明
本文为[Frog at the bottom of the well]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131849398508.html