One, background& problem


   The previous framework is based onSOA Distributed framework of thought design. Each application is provided and used by means of service, Communication between services isRPC Mode call, The specific implementation is based on.NET OfWCF Communication platform. The framework exists as follows2 One question:

  1, Lack of high concurrent processing capacity. High concurrent requests, Multiple services may be pending, Bottleneck of the whole system.

  2, With the wide application of mobile terminal, Service cannot be flexibly supportedAPP application.

  3, System continuous integration deployment is too cumbersome, Bad positioning in case of problems.

   Upgrade framework based on the above problems, Combined with the current mainstream architecture ideas, Service thinking of the system, Namely“ Microservice architecture”.

  

Two, Microservice architecture

   Microservice architecture(Microservices
Architecture) Split the system into multiple services, Commonly known as application services. Single application service implementation, Specific business application functions, Support independent deployment maintenance, Multiple application services build into a system. Between application services through lightweight communication framework, And support application services to be implemented with different technologies or platforms. Microservice architecture isSOA Another way to realize architecture design. Microservice architecture has the following characteristics:

 1, Microservice architecture benefits

  (1) Expand application services horizontally to improve the concurrent processing capacity of the system

  (2) Independent deployment and maintenance of application services, Conducive to iterative development, upgrading and continuous deployment

  (3) Flexible architecture supports multiple technology implementations

  (4) Good for application services to achieve high availability

 2, Insufficient microservice architecture

  (1) There are certain requirements for system design, In particular, split technology application service interface

  (2) Lead to the increase of the complexity of system implementation

  (3) Need to ensure system data consistency mechanism

  (4) Increase system maintenance requirements and costs

   Whether the system needs to be built with microservice architecture is determined by the project requirements. Design and build system with microservice architecture, Ability of team members is higher than traditional requirements, Especially design ability.

  

Three, Frame design principles

  1, Extensible: Support not modifying system functions, Expand server resources on demand.

  2, High availability: Support distributed deployment of dual machine hot standby mechanism, Meet the requirements of high availability of the system.

  3, High concurrence: Support rapid expansion of application service processing capacity, Improve system processing capacity, Meet concurrent requests.

  4, Safety: Access security through unified authentication access; Information security through encryption and decryption, Signature transmission; Network security through network isolation and firewall; Data security through scheduled backup and high error tolerance.

  5, Uniformity: Adopt the final data consistency strategy.

 

Four, Framework overall design

    

                                                                             
  chart1- System architecture diagram


   As shown in the figure, System architecture based onSOA Architecture design idea, And use microservice architecture to design and build. Separate system presentation from data. System presentation based on Web page, Supports multiple front endsUI Framework integration and custom development; Data provided by application services, Unified adoption“ gatewayAPI” Provide use. Architecture support through network layer, Load balancing Middleware in application layer, High availability and concurrent processing. Architecture separates some basic public functions into Middleware.


  1, gatewayAPI: Application service through gatewayAPI Unified external service. gatewayAPI Be based onhttp Agreement, withrestful Mode provides unified service interface, Agreed interface communication protocol, Support the function of system presentation, In a lightweight way of communication, Meet different clients. gatewayAPI Realize unified data access control, Routing application service, Current limiting and other functions.


  2, Message platform: Update synchronization information between application services, How to call distributed transaction of original system architecture to update information, Adjust to publish asynchronously via message/ Subscription processing, Ensure the final consistency of data, Reduce coupling and strong dependency between application services. High concurrency, Get caching.


  3, Service registration monitoring center: Responsible for application service registration, release and registration, At the same time, monitor the operation of application service interface, Support dynamic control application service to receive requests, Realization“ De centralization” service control. Component implementation service registration, Monitoring and other functions.

  4, authentication center: Responsible for unified identity authentication of architecture access. Control access through user password and authority. Combination“ gatewayAPI” Secure access, Current limiting and other functions, Realize the function of page management at the same time.


  5, Log management system: Responsible for recording system logs, Provide service interfaces and components, The business code transmits the log information to the“ Message platform”, Log management system subscription“ Message platform” Processing and storage of log information of. It also provides log management function.

  6, Cache Center: Be based onRedis Distributed memory database, Build architecture unified cache Center, Provide unified cache service.

   

Five, Software architecture design

        

                                                                              
  chart2- Schematic diagram of software architecture


   As shown in the figure, System architecture is developed in the way of microservice architecture, Observe each application service from the perspective of vertical independent development, Level according to responsibilities, There are four levels from top to bottom, RespectivelyWeb layer, Service interface layer, Business logic layer and data access layer.Web Layer is mainly responsible for the presentation and expression of system functions, Facing users directly; The service interface layer is mainly responsible for providing standardized service interfaces, Docking with presentation layer; Business logic layer mainly realizes application business logic, Is the core part of application services; Data access layer is responsible for data persistence, Support business logic layer. Isolation between levels through interfaces, Conducive to subsequent maintenance and expansion, Reduce dependence and impact.

   Integrated deployment after application service development.Web Layers will be integrated intoWeb Application container, Other levels are built to deploy for application services, And register the service interface for use..

Six, epilogue

   That's how the infrastructure is designed. Implementation deployment also needs to be considered, Elastic resources of cloud platform can be considered, Recombinationdocker Container technology.

   Later, we will introduce the design and implementation principle of related basic components step by step.. Technical framework is more important than problem solving, Design dependent requirements, Demand source actual business scenario.

 

author: Liu Cai Tao

Public address:【51dotnet】