Why does the system need to be layered?

Source: Internet
Author: User

 

Source: http://www.jdon.com/jivejdon/thread/36525

In daily software development, we generally adopt a layered architecture system. But why do we need a layered architecture? Before that, I think we need to understand two concepts: What is software?ScalabilityWhat is performance.

First, what is softwareScalability(Scalability)? We all know that well-designed systems can cope with increasing System Access traffic. But how can we increase the system throughput when the number of system users increases? This isScalabilityCharm.

scalability there can be two vertical aspects: scalability and horizontal scalability , vertical scalability increase the system throughput by adding resources in the same business unit. For example, increase the server Number of CPUs and increase the server memory. Horizontal scalability by adding multiple business unit resources, all business units are logically the same as one unit. For example, EJB distributed component models and cluster configurations all belong to this method.

Next, let me explain my understanding of performance. In our daily development, when it comes to performance, we generally first think of a large number of systems."Fast"What I want to talk about is that the performance also involves another aspect, that is, the system has"How many"That is, the throughput of the system. We generally consider these two aspects when considering performance.

UnderstoodScalabilityAnd performance, let's look at why the system needs a layered architecture.

First of all, the advantages of adopting a layered architecture are widely accepted. System layering is conducive to system maintenance and system expansion. This is actually the maintainability and scalability of the system.

Second, I focus onScalabilityToAnd performance. For exampleJ2EEIn system development, we generally adopt a layered architecture, which is generally divided into the presentation layer, business layer and persistence layer. Of course, we alsoThe layers can be further divided, but the layers cannot be too detailed. The specific project should be taken into consideration. The reason is discussed below. Let's think about what will happen after stratified development? Think about this, IYou can first think about the advantages of not using layering. This is of course that the processing speed of each business is faster, because communication between layers will lead to additional costs, therefore, after layers are adoptedThis means that the processing overhead of each business will increase.

Well, since the adoption of layering brings additional overhead, why should we do it? This involvesScalabilityAnd performance issues.

If no hierarchy is used, the system expansion and scaling mainly depend on vertical scaling, but vertical scaling is limited. With the expansion of the system scale, the cost of Vertical Scaling will also become very expensive. When the score is usedAfter the layer, although the communication overhead between the layer and the layer is brought about (thanks to the rapid development of computer hardware, if the development level of computer hardware is not enough to offset the additional overhead brought by the layer, the layered architecture is alsoThere will be a huge question mark, so to some extent, the layered architecture also uses a verticalScalability), But it facilitates the level of the layer.ScalabilityAnd each layer can be scaled independently without affecting other layers, suchEJBThe Distributed Component Model and the currently adopted sharded architecture are conducive to the levelScalability,

As mentioned above, there are two aspects of performance: " fast " , and " " using a layered architecture will of course affect the performance of quick bi, because the inter-layered communication will bring additional sales, but after adopting the layered architecture, our software system can become larger (" " ) that is to say, when the system needs to deal with larger traffic volumes, by adding multiple business units, we can source (in this case, multiple business units logically look like a logical unit, this is transparent to the outside world) to increase the system throughput. Therefore, for systems with high real-time performance, layers should not be too detailed. This will inevitably reduce the real-time performance, however, scalability system, we can introduce different layers to achieve horizontal system scaling.

The above is related Scalability and performance, and the relationship between them and the layered architecture, next, let me talk about another problem: Amdahl
Law ( amdal's law ), this theorem mainly describes the influence of the serial part in the system on the speed increase of the system, assume that the serial part of the Program occupies A % ratio, the program can be increased by up to 1/A % speed. I from this law, I can see the limitations of vertical software scaling, because no matter how many CPU If the program contains a serialized part, therefore, there is a limit to the speed improvement of the program, and the system performance cannot be enhanced without adding hardware . Therefore, for our software engineers, we need to pay more attention to the system level scalability .

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.