"Architecture school from scratch," notes - Part 1: concepts and basic

The first chapter Architecture Foundation

Modules and components

Module: Split Logically, the main purpose is the separation of duties

Components: Split Physically, the main purpose is the multiplexing unit

Framework and architecture

Frame: component specification (developed specification) to provide basic functionality.

Architecture: Description of the software system architecture

What is the purpose of architecture?

History software architecture

  • The first software crisis - structured programming debut

2000 programmer last year, incurring the cost of a quarter of the atomic bomb, producing 100w lines of code. The final ended in failure.

  • The second software crisis - object-oriented

    Lack of software scalability, productivity to keep up with the development of hardware and services.

  • Software Architecture

    With the increased scale software systems, when the system is made up of many parts, the organization of the whole system, leading to a series of new design problems.

    Only large-scale software systems will face the problem of software architecture

    • System, large-scale, serious internal coupling
    • Modified and extended difficulties
    • Logic complex, difficult to troubleshoot and repair

    [There will always be human limitations, when its capacity is insufficient to cope with the problem, in addition to learning, it should consider whether not their problem, but the problem itself over human limitations]

The purpose of architecture

The entire history of software development, and is a complex of historical struggle.

The main purpose of architecture is to solve problems caused by the complexity.

The complexity of the source

  • high performance

    Tubes, transistors to the integrated circuit, it is difficult to estimate the complexity. But this complexity is almost without regard to the selection, because no one would choose to buy tube computer.

    But for a different way to travel, bike, bus, train, high-speed rail, aircraft, before traveling will be based on distance, cost and other minor judgment. In the context of the times, there is no substitute aircraft and trains, bicycles and other tools, but the application of modern computers, the tube has been eliminated.

    The software architecture is in one trip, select the most cost-effective solution.


    In the software system, the complexity of the high performance requirements embodied in a single computer in order to bring the complexity of high performance and multiple high-performance computer cluster to bring complexity.

    • Stand-alone complexity

      Multi-process operating systems, multithreading, interprocess communication, multithreading and more.

      Redis single process, Nginx can use multiple processes. To analyze the specific use requires a combination of business.

    • Cluster complexity

      • Task Assignment: Use multiple machines, each machine can handle a complete business, but the task will be to design a dispenser, such as hardware F5, software Nginx and so on.

        With the increase in the machine, job task allocator will increase, become the new performance bottlenecks. This time we need to cluster the task allocator.

      • Task Decomposition: The split system into smaller components deployed to different servers

        Task allocation can break through the bottleneck of a single computer, but continued to increase machine efficiency will become increasingly low.

        An idea for a task decomposition, the system will break down, there are extensions for the.

        Advantages :

        • Simple systems are more easily targeted optimization, troubleshooting
        • You can extend a single portion, targeted

        problem:

        • Inter-system call resource consumption

        to sum up:

        Task decomposition and task allocation, as there is a degree, more than this, performance decreased.

  • High Availability : The system of executive function without interruption

    To achieve high availability through redundancy in nature.

    Redundancy: if the car battery to buy, once bought ten, the first one was stolen riding a second vehicle, second vehicle stolen cars to ride the third, and so on.

    • High availability computing

      Cluster configuration, while the bottleneck tasks assigned

    • High availability storage

      Storage cluster. But it will have the consistency of data transmission.

  • Scalable (based on experience)

    • Predict change
    • Cope with change
  • low cost

    Low cost and high availability, high-performance conflict.

    Introduction of new technologies, create new technology.

  • Safety


Chapter II architecture design principles

Architecture and programming gap: uncertainty.

Programming is certain, regardless of the manner in which, the results are positive.

The different architectures may produce the same results.

Suitable principle

Suitable better than the industry-leading.


Excellent architecture are designed in a variety of business constraints of the current human condition, business and so on. (Mechanically undesirable)

Simple Principles

Simple is better than complex.


The magnificent Great Wall, the Sydney Opera House's artistic sense, "complex" advanced manufacturing representatives, representatives of the construction sector in the lead, but in the field of software represents the problem.


Why complex software cause problems? ? ?

In addition to the complexity of software development, software is put into use, the need to constantly change. Ever heard of the Great Wall torn down to rebuild it.

The principle of evolution

Evolution than in one step.


For buildings, it is the eternal theme; and for the software, change is the theme.


Software architecture is more like a history of human evolution:

  • First, the need to adapt to the environment to survive (suddenly thought of the Upper Cave Man on the junior high school history book) harsh environment requires a lot of body hair to maintain a constant temperature of the body
  • In constant development, we began manufacturing tools, fire resistant cold start
  • Then later, build a house, used animal skins to keep warm
  • So body hair gradually degenerate, not eat raw meat
  • Mode of survival has become more professional segments from hunting
  • Today's Internet business to prosper, the brain to think more complex software architecture

    Software architecture analogy:

  • First of all, products designed to meet current business needs
  • After iteration in practical applications, retaining excellent design, eliminate useless design, increase the necessary design
  • Preferably, when a business major changes, when higher performance requirements, architecture to face the expansion, reconstruction; even code language will change, but experience in the course of evolution, logic and design will continue in the new structure. (Design Patterns strong push)

    [Do not Tandaqiuquan, do not blindly copying large company's structure]

Chapter III architecture design process

Complexity identification - Targeted

  • Complexity of business logic
  • Is there a cost to make high-performance and highly available

The main priorities of the complexity of the problem.


Use proven technology - Design options

  • Alternative to the best 3-5
  • Obvious alternative for a difference (such as the main and reserve for clustering scheme)
  • Technical options not already familiar with the limitations of the technology (if you have a hammer, every problem is a nail)
  • Options without too much detail (focus on technology selection, rather than the technical details)

Thought - assess alternatives

  • performance
  • Complexity and development time
  • cost
  • Spread

Crafted - Detailed Design

Nginx load balancing algorithm selection policy

  • polling
  • WRR
  • ip_hash

Guess you like

Origin www.cnblogs.com/noneplus/p/11495077.html