[Essence]web Architecture design experience sharing!

Source: Internet
Author: User
Tags count functions query
Experience | share | essence | Design |WEB Architecture

As a web engineer, I the most focus on performance and architecture, this time to participate in the sd2.0 General Assembly, to communicate with peers in a wide range of two, some of the experience, do not dare to enjoy, and the Bo friends to share, this is the participants and the audience with the exchange of experience, interested parties can view video

Several ideas of architecture design:


One, do not design: Never over

This is a topic that is often mentioned, but just think about how many functions you have in your architecture that are not used at all. or finally abandoned, you can understand the importance of the initial structure design, often inclined to design a large and a structure, hoping to design a very extensible, to adapt to all the needs of the additional structure, Web development is a very dynamic process, it is difficult to predict the next week's changes, but also need to make the fastest and most effective response to change.

Ebay engineers have said that their architecture has never been able to meet the growth of the system, so their systems are always reversing the redo. Note that not the ability of an ebay architect has a problem, the architecture they design always builds on the old version of the bottleneck, hoping to break through the new architecture, but the new architecture's breakthroughs are always flooded with new requirements in a short period of time, so they have to use another architecture
Web development, is a very agile process, changes are at any time, the user needs change, many aspects of contingency is very high, compared to software development, hope to use an architecture planning after all the design, is not realistic

Second, Web Architecture lifecycle: Web Architecture ' s life cycle

If you want to eliminate the design, but also to ensure a certain forward-looking, then how to find the balance of it? Hopefully the following Web architecture lifecycle will help you

The architecture is designed to grow at 1-10 times the size of a simple increase in hardware capacity, and during 5-10 times of growth, proceed to the next version of the architecture design to withstand the next 10 times-fold growth

Google has been able to dominate, not entirely because of the search technology and sequencing technology is more advanced, in fact, including Baidu and Yahoo, the technology used is now similar, however, Google's ability to achieve enough system capacity in one months by adding tens of thousands of servers is hard to replicate


Third, caching: Cache

Space in exchange for time, caching is always the most important computer design, from the CPU to IO, everywhere can see the shadow of the cache, Web architecture design heavy, cache design is essential, on how to design a reasonable cache, Jbosscache founder, Taobao's founder said: In fact, the design of the Web cache and enterprise-level caching is very different, enterprise-level caching is more logical, and Web caching, simple and fast for good.

What is the problem with caching? Is the complexity of the program rise, because the data spread in multiple processes, so synchronization is a problem, coupled with clustering, the complexity will be further improved, in practice, the use of what synchronization strategy often needs and business binding

The old money for Sohu design posts designed linked list cache, so that can meet the needs of flexible insertion, but also to quickly read, and other large communities often use the structure of the class to optimize the list of posts, Memcache is also a tool often used

Chan Hongwu on architecture design Video http://211.100.26.82/CSDN_Live/140/qhw.flv

The common strategy for cache is to keep the data in memory, rather than on a more time-consuming disk. From this perspective, MySQL provides the heap engine (storage) is also a way to think, this storage method can store data in memory, and retain the SQL powerful query capabilities, is not to kill each other?

We're talking about read caching, but there's also a write cache, less used in content-oriented communities, where the most important problem for a community is to read a problem, but when the processing power is lower than the request, or if a single request is cached to form a block, and then batch processing, the write cache appears. In a highly interactive community design, we can easily find such a cache

Four, the core module must own development: DIY your core modules

We have a deep understanding of this, Chan Hongwu and Cloud wind have also talked about, we often tend to use some open source modules, if not involved in the core module, it is indeed possible, if involved, then be careful, because when the number of visits to a certain extent, these modules are often have such a problem, Of course we can put the problem down to the open source of the module is unfamiliar, but anyway, the core problems, not fully grasp the code is very scary


Five, the reasonable choice of data storage mode: reasonable-storage

Do we have to use the database, not necessarily, Thunder tells us that the search does not necessarily need a database, Yunfeng told us that the game does not necessarily need a database, then when we need a database, why not simply use the file to replace him?
First of all we need to admit that the database is also the operation of the file. We need a database, mainly using the following functions, one is data storage, one is data retrieval, in the relational database, we are actually very concerned about the complexity of the database search capabilities, to see a statistical use of the TSQL to know (do not read carefully, sweep a glance on it)

Select C.class_name,d.class_name_2,a.creativity_title,b.user_name, (select count (Id) from review where Reviewid =a.id) as Countnum from creativity as a,user_info as b,class as c,class2 as D where a.user_id= b.ID and A.creativity_class=c.id and A.creativity_class_2=d.id
Select A.id,max (c.class_name), (Max (d.class_name_2), Max (A.creativity_title), Max (B.user_name), COUNT (e.id) as Countnum from creativity as a,user_info as b,class as c,class2 as d,review as E where A.user_i D=b.id and A.creativity_class=c.id and A.creativity_class_2=d.id and A.id=e.reviewid GROUP by a.id .... ..... ...............................

We can see the need for database association, the ability to sort, this ability is very important in some cases, but if your site's general operations are such complex logic, then the efficiency must be very low, so we often add a lot of redundant fields in the database, to reduce the simple query associated with the operation of the pressure, Let's take a look at the following diagram to see how the design center of the database, and the problem that the site (referring to the content community) needs to face is actually biased



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.