Web Application Performance Optimization

Source: Internet
Author: User

Web applications basically enter a site in the browser's address bar, then enter, and finally the browser displays what you want.

This is what the user can experience. What do we see as programmers?

The main process for an HTTP request is:

1, the DNS server resolves the domain name (the address of the browser address bar) to obtain the corresponding IP address, port number, service name.

2, the client according to the resolved address to the service AH send a request (establish a connection with the server).

3, the server according to the user request information processing requests, and to respond.

4, the browser more server response data (HTML/CSS/JS) rendering page.

That optimizes program performance, and as programmers we can optimize where and how to optimize.

The first step: we can't control it.

Step Two: Building links is more of a network problem. There's not much we can do.

The third step: the server processes the request, we do more. Because we are programmers, we are dealing with user requests for business.

A, processing business must deal with the database, we can use the data source to make the database link to the best (C3PO, DBCP)

b, with the database to establish a link, the database processing our request, which requires our database design optimization, SQL statement optimization.

C, the data cache processing, some of the requested data changes are not trivial, we can cache the data (Hibernate level two cache, Ehcache).

D, for some of the data is not high-real-time requirements of the page can do page caching (Oscache)

Fourth step: The browser renders the HTML page, we all know that an HTML page often has a large number of scripts (CSS, JS), and the browser when rendering the page encountered each

<link rel= "T" href "type=" text/css "> and <script src=" "></script> tag will send an HTTP request to the service every time the HTTP

The cost of the request is very high, so we want to:

A, minimize script files.

b, try to make the script file smaller (post-compression release makes the development version different from the production version)

C, for a large number of JS script we can use REQUEIRJS to manage our JS dependency.

Of course, the good server also has an access metric, if a lot of users, access is very large. Then use more than one server. The so-called cluster

Web Application Performance Optimization

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.