ASP. NET build high-performance website 1th article

Source: Internet
Author: User

Areas to consider for site optimization

When developing Web sites with ASP. Performance is always a matter of concern and attention, performance is not just the speed at which the program code executes, but the things that are involved in every aspect.

Take a request for ASP., from the browser to the Web site of the server to send the request started until the end of the entire page rendering in front of us, where the request passes through each step, there are different tuning methods, and the method of invocation is also many, not just common: caching, multithreading, asynchronous and so on.

The articles in this series decide on two big aspects to tell about tuning:

foreground tuning : mainly includes how to minimize the HTTP request, starting from the HTTP request, to how to load JS, CSS, how to compress the transmitted data and so on.

Background Tuning : Analyze the process of ASP. NET request, and give the corresponding tuning method at each step, and give the tuning method in code organization, architecture and database operation.

Remember that when the website was just developed, the easiest and fastest thing to think about is the cache, and in some documents of Microsoft's official best practice, it is also recommended: Layer-by-layer caching (in the data storage layer, DAL,BLL,UI, etc.). Then in the site on the "cache everywhere", the final really unsatisfactory.

Another common optimization is for databases: such as minimizing subqueries, using join joins, and indexing fields that often require queries. Indeed, these are very general and good rules.

There is also an understanding that, in optimizing performance, if you choose to optimize the code and database, often optimize the operation of the database will result in more good results, unfortunately: in the project (at least in some of the projects I developed), the database is just a data storage device, that's all, Does not play a powerful role in the database. Therefore, it is recommended to be familiar with the internal query and storage mechanisms of the database, after all, many times the developer is also working as a DBA (many companies do not have a formal DBA).

And in the project when we design the database, especially the table field, it is necessary to consider some, many people suggest that the length of the table field is not too long, this is common suggestions, but why? In fact, this needs to know some of the internal storage mechanism of the database: when the database (SQL SERVER) is saved, the data is in the "page" as the smallest unit, each page has 8 k size, if you have a table of data more than 8K, then the table data will be divided into several pages to save, So in the data query, it is necessary to cross-page query, cross-page is required performance consumption, if the data are on a page, then the speed is certainly faster.

So, to optimize the site, you need to know where the performance is consumed.

When optimizing a website, is not blind generalize, generally there are two kinds of situations:

1. The site already exists and is running, now to be optimized.

2. A new web site is being developed from scratch.

If it is the first case, then the first to find out the bottleneck of the site performance, from the foreground to the background of the request processing, until the final page rendering, will have to step-by-step review.

In the second case, it might be a little bit better, and the site is now completely under our control, and all of the development and design processes can be optimized using a number of optimization principles.

Optimization is not necessarily a code rewrite or make a lot of changes, the optimization of a little bit of accumulation, like the refactoring of code, is a cumulative effect. For example, in the beginning of the page to load the JS script, or at the end of the page to load the JS script, sometimes just simply adjust the loaded file, or asynchronous loading script, or through the CDN transfer scripts and so on, the performance is improved. Performance improvements are also not cost-free, and some are very small, such as simply loading scripts into the page at the end of the price, such as buying server devices such as content Delivery Network (CDN) to transfer static files (js,css,image) to the client. So, optimization requires a trade-off strategy.

Do not know whether people have this experience: when looking at the development of their own system can be very good, I am very confident, on the contrary, if the system is very slow, sometimes really do not want to say that the system is to do their own.

ASP. NET build high-performance website 1th article

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.