[Architecture] Architecture Overview

definition

  • After abstract business scenario support skeleton derived
  • Architecture business scene was born, and was abandoned by the business scene
  • Architecture design is no best, only the "most appropriate" (subject to the actual scene constraints)
    • R & D capabilities staff / service complexity / size data / time cost / operation and maintenance capabilities ...
  • "Most appropriate" all aspects of architecture is eclectic (Balance) results
  • Monomer Architecture -> registration, inquiries, orders are to set up a unit (micro Services Architecture)

aims

  • Features
  • performance
    • Indicators: QPS / TPS
    • Tools: apachebench (referred to as ab) / http_load / jmeter
    • Means: plus machine (brute), the front end of the optimization (the CDN / static and dynamic separation / decrease number of requests /), optimization backend code cache (e.g. redis), JVM optimized
  • Availability
    • Idea: to provide data redundancy through clustering, and high availability through the automatic discovery mechanisms to ensure failover components
    • Means: redis-cluster clustering, MongoDB cluster fragmentation, messaging middleware (ActiveMQ / RabbitMQ / kafka / RocketMQ) cluster, clustering, MySQL database
  • Flexibility
    • Idea: when system capacity is not enough, can easily expansion
    • Means: containerized, docker + k8s deployment management
  • Expansibility
    • When there is a demand changed or added, whether the function can be achieved without changing code or change very little code
    • Use of design patterns in the appropriate scenario
  • safety
    • XSS attacks
    • SQL Injection
    • CSRF attacks (cross-site request forgery)
    • DDOS attack (Distributed Denial of Service Attack)

Monoliths / ALL IN ONE / monomer architecture

  • Client
    • APP / applet / H5 / M
  • Server
    • All logic processing process in single server
    • Process
      • APP request to end service monomer
      • Receiving a request service monomer
      • Single service reads the required data from the database
      • Monomers data returned by the database service logic processing
      • Monomers encapsulation service returns a result, returns to the end of APP
  • Separate front and rear ends
    • APP is a front end, Server backend
    • Server returns only the data to the APP, without presentation logic
  • For example
    • Multiple page requests processed in one process
      • User profile: query personal details
      • Product Details page: Details Product inquiry
      • Transaction history page: Get transacted Product List
    • Question: coupling, such as a person responsible for a function, each person must submit code recompilation war

Microservices / distributed micro-services architecture

  • Split Monoliths
    • Vertical Split
      • Database-like sub-libraries
      • By business split into three processes
      • User / commodity / transaction ...
    • Split Horizontal
      • Similar sub-table database (info% 1024)
      • Further according to each service request functional split into three processes
      • Receiving a request / read library / business logic / ... Back
      • Gateway layer / business logic / Data Access Layer / or the Cache Database
      • Gateway layer, data access layer stable commodity
      • The business logic changes frequently
      • SAAS layer gateway service
    • Asynchronous architecture
      • Architectures for a longer waiting time
      • MQ increases between the gateway and the business logic layer
    • Pervasive Architecture
      • + Gateway business logic layer (business logic simpler)
      • Data Access Layer Yewuluojiceng +
      • Business logic layer thinning, abstract common business logic layer
      • DNS resolution / static resources / dynamic interface data
      • Gateway layer: Tomcat supports connectivity weak
      • Reverse Proxy: bear a greater flow (one million), corresponding to a 100 Nginx IP 100
      • LVS virtualization layer: the virtual IP 100 to IP 2
      • Static resources on CDN, every city has a node
      • DNSPod
      • For general OLTP scene
    • Protocol classification
      • letter of agreement
        • HTTP/TCP/WebSocket...
      • Data transmission protocol
        • JSON / XML (text)
        • ProtoBuffer / MessagePack / Dubbo / private ... (binary)
    • Protocol selection
      • APP <-> layer gateway
        • No connection needs long, with HTTP / HTTPS + JSON
        • Long connection demand (Active Server Push message to the APP, IM), using TCP / WebSocket + ProtoBuffer
      • Gateway <-> logic layer <-> Data Access <-> DB / Cache
        • TCP for communication
        • Large data packets, binary protocol / SQL / Redis

   

(Left: DNS, in: Static, right: dynamic)

China-Taiwan model

  • The product data technology and operational capabilities stripped from the front desk, called independent in Taiwan
  • Including the search division, shared Division, Division, and other data platform, to provide services for the front, ie retail electricity provider business group
  • Business units, technology units, data sets, algorithms Taiwan

 

reference

OLTP和OLAP

https://baijiahao.baidu.com/s?id=1611554859260686629&wfr=spider&for=pc

Guess you like

Origin www.cnblogs.com/cxc1357/p/12521524.html