An article to understand the architectural skills of large websites

1. Write in front

    The word "architecture" is a very big proposition, and it is usually difficult to describe this thing in words. Let's not talk about the word "architecture", let's look at some phenomena first.

    1. For developers who really do practical work, they usually have a similar feeling. Architects usually draw ppts, but they can't write codes.

    2. Every time there is a meeting, various concepts will be discussed, but they cannot be implemented.

    3. You can talk about any technology. You ask for details and how to achieve it. He doesn't know, and always says that he doesn't care about the details.

    4. Always flaunt yourself with a high-profile attitude.

    There are actually a lot of phenomena such as the above. I can't comment too much. I can only say that they do not love the software industry, at least they reject this industry in their hearts. But I think that a simple technical person should have a pursuit, take "passing on to teach and solve puzzles" as a responsibility, cut open the gorgeous packaging of technology, and restore the truth that technology wants to tell people.

    Note: The above is not intended to criticize anything.

2. Reason

    Looking back on my technical career over the years, I still feel very deep. From Java web development, to big data, to machine learning, and then to deep learning, all the way I want to reveal the truth of technology. I also slowly figured out some things. The essence of what the program does can be described in this way, there is a black box, you give it an input, and it gives an output. So to get this "black box", there are two ways, hard coding and machine learning, so that the truth of all technologies can be described. Program and machine learning are essentially the same thing, but the way to get this black box is different, please see the figure below. ps: What does big data technology solve? From the perspective of "cold eyes", I also summarize some words, and then write an article later.

    

    The above is a bit far-fetched. Recently, I have re-read Li Zhihui's book "Technical Architecture of Large Websites", which is a very concise and wise book. Summarize the core elements of a large website. This film blog will combine this book and write something.

3. Architecture

    Before talking about the architecture, let's talk about what is the core problem that a B/S structure wants to solve? The core problem it wants to solve is the problem of high-speed and accurate reading or writing of data at any time. Around this issue, we have to do some considerations for the design, which should be called architecture. Architecture is a plan at the highest level . Once it is planned, it is difficult to change. Just like the plan of life, the path you have traveled cannot be repeated.

    1. Core requirements

    High performance : any time the website is operated, it can respond immediately

    High availability : accessible at all times

    Scalability : The business can be expanded at will without affecting the original business

    Scalability : The server can be scaled horizontally or vertically, and of course it can be scaled down at will

    Security : Resisting Attacks

    2. Architectural Patterns

    Around the above requirements, what design ideas can we use?

    Layering : The idea of ​​layering is actually a very simple design idea in the computer, such as the 7-layer network model, the 5-layer model, etc. Of course, for the web system, the view layer, service layer, and data layer are the most important. Basic layering.

    Segmentation : Reasonable segmentation of the business

    Distributed : Different businesses, divide and conquer

   Clustering : Single Application Scale-Out

    Cache : front-end, back-end cache, multi-level cache, etc.

    Asynchronous : multi-stage split business, message-driven

    Redundancy : web node redundancy, data redundancy, remote disaster recovery, etc.

    3. High performance

    Metrics : Response time, concurrency, throughput (TPS, QPS, HPS)

   Web front-end optimization : reduce http requests, use browser caching, compression, reduce cookie transmission, CDN acceleration

    Server-side optimization : distributed cache, asynchronous, clustering, code optimization (multi-threading, resource reuse, fullgc reduction)

    Storage performance : mechanical hard disk, solid state disk, indexing technology (B+ tree, LSM)

    4. High availability

    High availability applications : stateless service clusters, stateful session service clusters

    High availability service : cluster (hierarchical management, timeout setting, asynchronous call, service degradation, idempotent design)

    High availability data : CAP theory, data consistency, data backup (hot and cold backup), failover

    5. Scalability

    Scalability design : physical separation of different functions, single function cluster

    load balancing

   Distributed cache

   Data scaling : sub-database sub-table, master-slave backup

    6. Extensibility

    Event-driven : Decoupling through message queues and extending with event-driven ideas

    Service-oriented : decoupling and horizontal expansion by means of interface

    7. Security

    xss, injection attack, CSRF

    Of course, with deeplearning, Gan's ideas can be used to find the boundary of attack traffic.

4. Attach the big picture

    The following are the important parts of the whole book that I have sorted out.

    

  V. Conclusion

    To measure the quality of a person's technology, breadth and depth are important, but there is one of the most important indicators: whether it can quickly and elegantly solve the current problem . There is also the most important sentence, not technology for technology's sake.

 

Happiness comes from sharing.

   This blog is original by the author, please indicate the source for reprinting

 

 

{{o.name}}
{{m.name}}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324175291&siteId=291194637