Optimize performance in the Web

Source: Internet
Author: User

Introduction to optimizing performance in the Web

Web optimization is a war that prevents HTTP requests from eventually accessing the database.
The way to optimize is 加缓存 to cache each node.

Process and node for Web requests

Be familiar with processes and nodes in order to locate performance issues. and the order of optimization is generally optimized by the requested process. The process here is simply a summary and does not represent comprehensiveness.

The entire process is the fastest way to let users see the results

How to locate

The idea is: 把看不见的http,具体化、可视化 .

Positioning is the precondition of optimization. Without accurate positioning, the problem cannot be solved effectively.

Browser
    1. Look at the time of the whole request
    2. Look at the time the entire page was loaded
    3. Look at the size of the page loaded data
    4. Look at the number of page requests

For example:

Locating results

    1. Background request is slow
    2. Is the front load slow (document,js,image,request number, etc.)
Server monitoring
    1. Look at the time of the whole request
    2. Look at the SQL time (this can also be done in the database via slow log)

For example:

Locating results

    1. Which URLs are slow
    2. Which URLs are most commonly used
    3. Which SQL is slow
Monitoring of the Code
    1. To locate through System.out.print or break points.
    2. Add an AOP to each method to monitor the execution time of the period
      For example:

      Long begin = System.currenttimemillis ();
      Execution of the method or code
      Long end = System.currenttimemillis ();
      System.out.print ("Total Execution Time:" + (End-begin));

Locating results

    1. Which method or code has slow performance
Monitoring of the database
    1. Slow log

Locating results

    1. Which SQL is slow.
Solution Solutions

Idea: The nodes that are targeted for HTTP requests are sorted out in order. For the time being, do not consider starting 分布式 with 群集 the solution and optimization.

Optimization Agent
    1. Plus gzip (reduce the amount of HTTP request data)
    2. Caching of static resources
    3. Nginx Cache Integrated URL-level caching
    4. Static and dynamic separation
Optimizing the Web Container
    1. Optimized burst protocol
Optimized applications
    1. Add cache
    2. Reduce IO (reduce the cycle of Io, get in bulk, then process at the code level, optimize the algorithm, and turn the tree complexity into level complexity)
Optimizing the Database
    1. Add index
    2. Add redundant data
    3. Modify table structure design (this is important, sometimes because the table design is unreasonable, can be solved by adjusting the design)
    4. Add cache
Other Notes

The optimization aspect is not limited to the method above. Some do not have one by one to repeat. For example, adding memory is also a good solution for optimization. There are also operating system level, IO Read and write, network requests and other issues.

Original link http://www.cnblogs.com/ansn001/p/5301134.html

Optimize performance in the Web

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.