Web Application Performance Optimization and web Performance Optimization

Source: Internet
Author: User

Web Application Performance Optimization and web Performance Optimization

Basically, web applications enter a website in the address bar of the browser, and then enter it. The browser displays what you want.

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

The main process of an HTTP request is:

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

2. The client sends a request to the Service (establish a connection with the server) based on the resolved address ).

3. The server processes the request based on the user's request information and responds accordingly.

4. the browser renders the page with more server response data (HTML, css, and js.

So we need to optimize the program performance. As a programmer, how can we optimize it.

Step 1: we cannot control it.

Step 2: establish connections to address network problems. We don't have much to do.

Step 3: when the server processes requests, we will do more. Because we are programmers, We are processing user requests.

A. The processing service must deal with the database. We can use the data source to optimize the connection to the database (C3PO, DBCP)

B. After establishing a link with the database, the database processes our requests, which requires our database design optimization and SQL statement optimization.

C. cache data. Some requests have extraordinary data changes. We can cache data (hibernate's second-level cache and ehcache ).

D. You can cache webpages (OSCache) for pages that do not have high requirements on real-time data)

Step 4: When the browser renders HTML pages, we all know that a large number of scripts (css and js) often exist in an HTML page.

The <link rel = "t" href "type =" text/css "> and <script src =" "> </script> labels send an HTTP request to the service, each HTTP

The request costs a lot, so we need:

A. Minimize the number of script files.

B. Try to make the script file smaller (release after compression makes the development version different from the production version)

C. for a large number of JS scripts, we can use requeirJs to manage our js dependencies.

Of course, a good server also has a high access volume. If there are many users, the access volume is very large. Use multiple servers. That is, the so-called Cluster

 

Related 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.