Zhu Ye Internet architecture practice experience S2E7: Talking about work platform architecture (infrastructure, basic services, basic platform, the foundation middleware, etc.) ...

Foreword

Program development, after all, is not moving bricks that no physical brain, there is need to advance standards, architecture, design there is definitely not a new company founded today, tomorrow you can start coding. In fact, many companies do not start in time and financial resources to build a separate infrastructure or platform architecture department, and even operation and maintenance team are not, but this does not prevent our hearts to know there is a blueprint for the direction of the efforts of this article we will talk about simple platform architecture work-related content (or as a technical management, should go to sort out, unified, clear part) blueprint. As more content covered herein can only initiate probably mention some, it can not expand too much detail eleven things. Numbers in the figures is I think the priority is for reference only.

specification

Although it is not an actual specification of code or components, only a document, but I think it is very important. No specification, then add employees go on any line of new code may have been wrong, the whole development process may also lead to a lot of unnecessary because there is no specification of the accident produced.

  • Code Submit & branch management practices, we can be refined based on the actual situation (in conjunction with the operation and maintenance process, project complexity, number of teams, release cycle) in gitflow basis, related to:
    • What are a few permanent branch, which several temporary branch?
    • Branch naming convention?
    • Submit code description specifications?
    • Branch and move out of the merger of the opportunity?
    • Which branch of the average developer does not have permission submitted directly?
    • What with testing branch, the branch line and what use?
    • Multi-Version Concurrency develop mention how measured?
    • How Hotfix processing branch?
  • Coding standards, such as Java code can be based on manual Ali Java developers, everyone over again, (time requirements, performance requirements) the actual situation of the project, select some of them firmly maintained, and add some others. We can also let you use an IDE (import) Unified Code Style Template to ask the same encoding format. Because the Code Style inconsistencies led to a wide range of time to submit new code will be deleted entirely pollution submit, so that we submitted the code is difficult to see in the end what changed.
  • Database design specifications. Ali Java Development Manual contains a small part of the database design specifications, industry specializing in surgery, this should still ask senior DBA is given a certain specification, including, but not limited to:
    • Name (name prefix-suffix tables and fields, foreign key field name, universal naming uniform field) specification
    • Field design type specification
    • Field redundancy specification
    • General field specification
    • Use Index
    • ....... Can refer to the "Internet architecture practice Zhu Ye experiences S2E1: What business code is hard to write? "Some of the content mentioned in
  • Project specification structure, it is essential for Java Maven project directory structure is relatively uniform, for other project languages ​​(such as Python), the directory structure without a certain standard, then, the project source code structure will be strange, it's best to structure a project specification, including :
    • Three-division structure directory
    • Multiple Environments (Profile) profiles
    • Service interface, service implementation, Web, Job module named
  • Finally, project management processes, some companies will have a dedicated PMO, there are some start-up company developed Leader will act as the PMO, though this live platform architecture in general and have nothing, anyway, since it is a project must ultimately project management as a point of concern technical management roles, project management processes is more important:
    • Iteration cycle, the time point iteration in large part probably occurred
    • What will open, the meeting point of time? (Day station will, weekly meetings, will start, will be recalled, will be re-set, will schedule, PRD pre-assessment will, PRD will be assessed, the test case will be assessed on-line program Symposium)
    • Project life cycle which documents the role of each output?
    • Where management tasks, each character how to maintain the flow of job status? Circulation of each state impossible task to do by the PMO

Basic framework

Use some of the basic framework is necessary to do application development for Java technology stack, the familiar framework Spring Cloud family bucket, Spring Boot kit (various starters package), Mybatis, etc., use these frameworks can be developed but more is recommended by the infrastructure team packaged its own frame, make their own layer of packaging, we can in a similar Spring Boot Starter model for all components of the package own Starter module, the benefits are:

  • Facilitate unified external dependencies libraries & library versioning and conventions
  • Easy to do for the company's internal situation more appropriate auto-configuration (even realize 0 configuration)
  • If the internal technology stack is heterogeneous, then use a unified framework helps open up the technology stack back-end infrastructure
  • Get through monitoring for all modules, automatically configured accordingly AOP interception unified crawl obtain monitoring data
  • Between the module and can be integrated with each other, to achieve the effect of 1 + 1> 2
  • Another very important point is that we can provide the appropriate background to match the control framework used to frame configuration, management and auditing exposed on the console

In fact, plainly, is to use your own package library account pit, even if only a shallow layer of packaging, is also very good, just do a variety of unified (unified framework to use, unified framework version number), more because accounted pit (of course, do you want to extend Java agent dynamic bytecode injection are possible disadvantage of this approach is no way to provide an API for business use), directly after the frame can be upgraded by IOC + AOP direct replacement components do various extensions (no need to bother the business team).

Let's look at some of the common module business development need to use here is probably on the mind map listed (you can look at our open source framework SummerFramework ( github.com/ke-finance/... ), of course, out of the open-source module is relatively small , the actual internal company encapsulates all modules mentioned here:

  • Web MVC: can be encapsulated based on Spring MVC, add some template engine support
  • Data Access: or may be encapsulated based MyBatis Mybatis Plus + Druid data source, do some additional features, such as encryption of sensitive data stored
  • RPC service call or micro-service: You can package based on Dubbo or Spring Cloud (Feign + Eureka), extended some of the more intelligent LB algorithm, and routing policies (such as gray) On the client side functions
  • Web API: can be implemented in Spring MVC + Swagger UI based on the function to provide a unified standard API RESTful server, such as standardized API version, automatic packaging structure response (adaptive), improper packing, HATEOAS hypermedia resource navigation integration, data encryption and decryption achieve standardization Collection resources, realization of automatic interface mock
  • Configuration: based on Cheng Apollo ( github.com/ctripcorp/a... encapsulation) client, do autoconfiguration
  • Message: may be encapsulated RabbitMQ, RocketMQ client unified messaging API, then the extended transaction messaging (messaging service logic and local transaction in a transaction) and other functions
  • Cache: based on CacheCloud ( github.com/sohutv/cach... ) provide Redis caching services
  • Scheduling: may be packaged XXLJob ( github.com/xuxueli/xxl... ) or ElasticJob ( elasticjob.io ) provides scheduling services
  • Log Monitoring: Micrometer can be achieved based application runs, find a APM (Skywalking github.com/apache/skyw... or Pinpoint github.com/naver/pinpo... do log desensitization) integrated trace function, extended logback, extended Spring Boot Actuator Endpoint other functions
  • Lock: Redisson package can be based on a distributed lock, using a unified API to provide distributed memory locks and lock
  • Distributed Transaction: mainly two synchronous 2PC distributed transaction processing (such as our open source https://github.com/ke-finance/dts), to achieve saga idea of ​​asynchronous, reference https://github.com / eventuate-tram / eventuate-tram-sagas.
  • Elasticity: + + isolation fuse flow control, based on consideration of https://github.com/alibaba/Sentinel implemented, may be a separate service module, may be integrated into or RPC Web API module to
  • Security: can be extended based on Spring Security, added risk control strategy in line with business needs into

Basic Platform

Basic platform (management platform) and need to play with the basic framework, the framework is used to develop when more platforms are used in the development or operation and maintenance personnel to do technical operations. Many open-source framework already provides management background, we need to do may be just some minor modifications, such as including:

  • Open up the company's own internal system login account and permissions system
  • According to the management console to deploy multiple different environments (development, test, gray, production)
  • According to need to see whether you need to do the transformation of multi-tenant service isolation

Some platforms are heavy process, which may require self-development, probably introduce them mentioned on the mind map:

  • Configuration Platform: If you use Ctrip Apollo, Apollo is the use of natural management background
  • Micro Service Management Platform: I list here the two aspects, one is the service center, more of a service maintenance, management, monitoring aspect function, can be modified based on Spring Cloud Admin; a service market, more and more standardization of management services, such as on-line documentation service needs, monitor system access, and unified on the line documentation Center, the service market similar to the concept of the App Store
  • Cache platform, if used CacheCloud, you can use CacheCloud management background
  • Log platform, is divided into two, one is to show the basic ELK log collection is already standard; there is an abnormal alarm log, can develop themselves, do log filter based on Kafka consumption + asynchronous log aggregation combined with the company's own IM and email system alarm done
  • Database management platform:
    • DDL / DML workflow: Developers submit an application, the competent examination and approval, automatically, plus automatic detection of risks, optimization suggestions
    • DDL / DML change notification: big data and to facilitate the operations team to subscribe for databases and tables of interest in DDL applied to various environments (test, production) time can be the first to be notified can be manual, automatic processing (similar to before , after Filter concept)
    • Knowledge database: a single place to view the description of the database structure, the dictionary definition of enumeration
    • Of course, database management platform can further do a database monitor, slow SQL optimization cause analysis and other functions
  • Full link tracking platform: for example, if you use Skywalking, then you can manage it provided the station, the main function is nothing more than rely on topological analysis, Trace view, service performance analysis
  • Index View Platform: divided into two, Dashboard can generally be considered directly Grafana, although Grafana alarm if there Alert but it is recommended in the lower level (data source) to do it, you can do it based on the timing based stream processing or pull mode to achieve

Middleware foundation

Middleware refers to a standalone deployment does not have a universal service business logic coupled storage services in a broad sense is not not return to the middleware, probably listed here a few typical:

  • MQ broker (Broker, not the Proxy), such as RabbitMQ, RocketMQ, Kafka
  • API Gateway, there are many open source gateway implementations, such as Kong ( github.com/Kong/kong ), the Spring Cloud Gateway, we have achieved a https://github.com/ke-finance/tesla, general major gateway function call routing, protocol conversion, call scheduling, and also provide a lot of security plug-ins and filters to form extensions of elasticity
  • DB agent, and such similar https://github.com/flike/kingshard https://github.com/Qihoo360/Atlas the MySQL Proxy, separate read and write the database, library sub-sub-table, failover, elasticized, monitoring, SQL optimization functionality
  • ES cluster can also be understood as middleware, after all ES actually we do is based on Lucene distributed cluster management

These middleware Although a lot of time to do other services Proxy behind, but the node itself is likely to have a state, but also need to consider the problem of high availability middleware itself.

Basic services

In general if the company has a number of projects, then, between the project will certainly use some common internal and external capabilities, which not too many relationships and business logic, consider these the ability to deploy a unified micro-encapsulation independent service out the form provided, all such projects can be quickly docking.

Here the basic services are divided into two types, one is not a pure business logic basic services, are often packaged one or more external docking service channel, the other one is basic service comprises a number of business operations. For the first type of basic services you might think, since it is an external docking service channel directly using their SDK or the use of those services are not directly in the business system tripartite SDK just fine, basic services is needed to do what? I think the basic service package should be so:

  • Services SDK package external services, such as text messaging in general or, push Ye Hao, Ye Hao store will do more than use the provided backup, demotion, to provide a unified internal API through our SDK, the SDK API different shield difference
  • A server, for data on the server side landing, the landing has several purposes:
    • Convenience and consumer services externally reconciliation
    • Convenient time to find the cause of the error
    • Convenient services and external synchronous call status (such as SMS arrival)
    • Balance facilitate early warning service
  • In addition to the server for data floor, made from single server export benefits are:
    • Do access control, in general, even calling the company's internal projects to basic services should also be required to apply for re-use, or even need to do a service call volume control (similar to re-implement SaaS layer inside)
    • Source IP convergence calls
    • Centralized management SaaS service call external key
    • Downgrade and switching strategy to replace more convenient external service
    • Accessing party to do alarm
  • Do a management background, although external service providers as SaaS products generally will have a good console (in fact, more often, it is impossible to put authority external service console for all to see, to see their own internal business party basis service console can), but we do an internal management background is still very large sense, the main function is generally:
    • Unified login
    • Accounts (including Secret) application and distribution, as well as quotas, limiting and other configurations (administrator privileges)
    • Call records (request, result) view
    • (Before use to think about is not open to use services, such as SMS, e-mail, push is generally based on the template, template requires internal and external audits) configuration template is called

If each service has a console, it can greatly facilitate autonomous access issues and the business side of the investigation, which is the basic service package a very valuable point for large point of many projects within the company even more in need of basic services internally of the SaaS, but the best (unified place to apply all the basic services needed) for different basic services open up access party.

Here the mind map is probably listed some common infrastructure services and business services, each company according to their business usually not the same, basic services include:

  • SMS: SMS access multiple channels, according to the policy, rates, routes arrival rate
  • File storage: Access multiple small files storage services (such as seven cattle, Tencent cloud), according to the storage service provided by function, file size, rates and other routes
  • Message: internal and external access (such SendCloud) mail service, according to the route usage scenario
  • Push: a plurality of push access channels (such as Aurora, a push), the relationship between the user and make equipment maintenance
  • Unique ID: generate a globally unique ID
  • Graphics, slide, click, intelligent verification code: verification code to provide a unified service, code can be automatically selected according to the type of scene
  • Electronic signature: a plurality of electronic signature service access route based on the rate and other factors
  • Map Service: a plurality of access external map service, a service selection function according to the access side and a map for use

Business services include:

  • RBAC access control: a unified RBAC configuration daemon, and convenient SDK
  • General forms service: The collection of background configuration interface generated form, and the form information
  • The state machine: can learn https://github.com/hekailiang/squirrel, based on the state (State), behavior (Action), transfer (Transition), the concept of condition (Condition), etc., built on the platform of the database state machine
  • Unified payment: payment aggregation, business party can quickly access a variety of payment channels and unified pay the cashier to pay and can provide a unified SDK to achieve a unified H5
  • Workflow, reptiles, SSO ...... not explained in detail

Engineering efficiency

The next project also briefly mention the efficiency and scope of the operation and maintenance of things, though it lacks so much architecture and platform, but these two are very important technology infrastructure work:

  • Source Repository: Gitlab can select such a three-piece or atlassian Bitbucket
  • Internal library Warehouse: such as Java Maven repository, you can build your own Nexus warehouse
  • Project management platform: You can select SaaS products (such as Tower, Teambition), the more famous is the three-piece Jira atlassian
  • Knowledge management platform: You can choose SaaS or open source Wiki product, the more famous is the three-piece Confluence atlassian
  • Bug management platform: for example, you can choose the Zen or direct reuse Jira
  • Code quality analysis: For example, the platform can be built SonarQube

Operation and maintenance

Some systems operation and maintenance related work and some companies mentioned here is to build the architecture team, a column about:

  • CI / CD Platform: general need to own the combined company's workflow and do another CI / CD platform (based on the underlying Jenkins (script or direct SSH +) package), the platform requires a combination of the company's work processes do, such as who can initiate the process, every aspect of publishing who need approval, release time window, etc.
  • DNS platform: usually used directly domain management's platform or the platform similar DNSPod
  • CMDB: usually self-built platform according to their own circumstances, metadata and configuration management at all levels of operation and maintenance related resources
  • Monitoring: usually based on Prometheus + Grafana + Zabbix and other open source project to create the basis for monitoring the operation and maintenance
  • CDN platform: the cloud is generally used, for example, seven cows, or they shoot the three major cloud services can CDN
  • Cluster Configuration management: This does not mean CMDB, refers to the bulk clustered configuration application operations, platform management operations, such as Chef, Puppet, Ansible, Fabric, general reform package is based on open source or directly with open source
  • Container arrangement: for example K8S platform, the general might do based k8s own set of API k8s management and control platform or use similar Rancher this better with a higher level of service, based entirely on k8s operation and maintenance of the command line is not very efficient and easy to use
  • Container warehouse Mirror: for example Docker private warehouse Harbor

to sum up

Well, certainly some of the large Internet companies have more than 100 internal systems and research and development related to, or even need a dedicated navigation site to manage project efficiency, operation and maintenance, basic framework, basic services, infrastructure middleware, the underlying platform these sites, which the system itself is no small maintenance workload, you will find that in addition to finishing a business program there are so many things around for R & D services, we welcome supplement for the content of this article.

Guess you like

Origin blog.csdn.net/weixin_33943836/article/details/91389302