First, what is a distributed architecture

Preface:

  With the rapid development and progress of the Internet, various industry ushered in the opportunity of rapid development, and in this one Java language in this age of the Internet as a mainstay, is also in constant innovation, and our Internet companies such as more complex business and user requirements so that our traditional stand-alone projects increasingly difficult to meet the requirements, and in this one was born out of another philosophy of "distributed", distributed in response to the emergence of the complexity of business continuity and business demand.

First, the era of stand-alone project:

  Advantage:

    In the era of traditional stand-alone project, we project the functional modules are put together, such as: user management, product module, statistics module, which for a small team or a small project, whether it is for maintenance projects or complexity of the project, it is of great advantage, so that the stand-alone project team set up a perfect fit for our initial construction soon.

  Disadvantages:

    But everything is not absolute resistance, for example: if it is a medium to large projects, such as the electricity supplier projects, there is a lot of modules, user module, payment module, the merchant module, reconciliation module, statistics module and so on, this time to think about us one problem, if we put all these modules together on what will happen?

    For example, one thing we changed a little BUG user rights, we want to update the project, then had to face the redeployment of the entire project, and our payment, statistical data with real-time, redeploy the project would have to pay close module, which for a company or business is a very serious problem.

    Another example is a day we update new features, updates to the production environment has a problem, and this problem has led to the entire project can not run, can not be taken for granted payment function normally pay, presumably this time the company's customer service phone will be ringing off the hook, soon boss will ask you to tea, this time the traditional stand-alone projects will encounter a variety of packet leakage problems.

    

Two, Maven structure of the project:

  Above we understand there is a bit of a stand-alone project development strengths and weaknesses, in the above item with a constantly updated java Maven project management appears that our development model has emerged a big change, we will split into multiple sub modules, and multiple sub-modules have inherited a parent module, parent module is responsible for the project with the new version:

      

  Advantage:

    1: to achieve a decoupling project business layer;

    2: the business layer can improve the reusability of code;

    NOTE: This architecture is not a distributed architecture, and no decoupling code, since the individual sub-modules are modules of code that depends on the other, you need to import submodule other jar package, and there is no decoupling of the code ;

    Above architecture can solve the problem to some extent on our stand-alone project, we envy of electricity supplier payments and other modules as an independent project, if one person login module is a problem, we just need to update the login module to restart project, we are fully paid modules you do not have to manage;

  Disadvantages:

    Although the above structure of the project can solve the business layer decoupling stand-alone projects, but also there is a problem is that it does not decouple our code level terms, we need a lot of jar package must be imported in order to ensure that the project the normal operation.

Third, the distributed architecture:

  In the above we saw architecture as well as stand-alone project Maven infrastructure projects ( Note: does not this argument, but we do understand ), they are some advantages but also some disadvantages, and in order to meet our increasingly complex business and bloated project, java developers have proposed an alternative architecture "distributed", the emergence of distributed architecture is to the outcome of the above methods can not meet the business needs:

  We still electricity supplier to the project, for example, such as we have electricity supplier payment module, timed task management module and other modules pumping high reusability became a separate project, this time we are no matter how many systems or used to pay regular tasks we just need to call on it, but this is also a problem, we have mentioned above to.

  For example, our project would not only electricity supplier to the next figure three jar, if which involves a dozen or dozens of jar, this will lead to our main project is very cumbersome and difficult to maintain, and this we must consider how we separate out these modules in the project but does not introduce a jar of these modules, and this is the micro-service architecture;

  Micro-service architecture is among our projects and independent except for a number of modules to build up a bridge, the bridge can make, etc. SpringCoiud or Dubbo, so we do not separate out those modules and deal directly, and the middle of the bridge to deal directly, he will automatically determine the module calls, thus avoiding the introduction of too much jar, leading to a bloated and difficult to maintain the project's shortcomings;

  

  This time we will know what is micro-services, so-called micro service is to split the project in every business, every business split node as an independent project, users access the service via middleware registration and found to achieve, this is micro services architecture;

 

Guess you like

Origin www.cnblogs.com/zouxiangzhongyan/p/11563040.html