Website access optimization, to be continued

Source: Internet
Author: User
Tags free cdn piwik
In the afternoon, the website was spit out and the visit was too slow.
Initially, I thought it was the banner picture of the home page, which was too large to be the result of the 500KB HD map. Immediately to look at the next, banner large image has been compressed to 50kb.

So, not a picture of the problem.

Use Chrome to open a Web site, disable caching, and overall access:
272 requests, 2.68MB, time consuming 5.56s (load:5.03s,domcontentloaded:2.45s)

Find the top 3 files first:
Jquery.js 118kb, Server local, and no compression, time consuming 2.12s
Layout.css 55.8kb, Server local, and no compression, time consuming 1.58s
Banner.jpg 53.2kb, server local, compressed HD image

There are a lot of JS, all spent 1~2s.

Since the visit is so slow, it has to be optimized.
Do 2 steps First:
1.jquery.js, such as public JS files, using the online free CDN.
http://www.bootcdn.cn/stable, fast and free Open source Project CDN Service

After use, takes 4.57s (load:4.03s,domcontentloaded:1.30s)
Save 1s.
CDN version of jquery size 38kb, load required 100ms.

2.LAYOUT.CSS, such as local JS and CSS resources, compression deployment.
4.25 (load:4.03s,domcontentloaded:1.30s)
After compression, time does not decrease.
By the server's bandwidth and response speed, the impact is relatively large.
(Download a compressor from the Internet, download the address: http://dd2.pc6.com/xc1/JsCssZip.zip)
--------------------------------------------
After trying the previous 2 steps, the effect is more obvious is the 1th step, Jquery-cdn.

In the chrome console, network Further, sorted by time and found some problems:
1.piwik.js
Time Consuming 2.12s
Piwik is an open source PHP statistics tool, initially only used Baidu statistics, and later want to do a set of monitoring code.
Hey, Piwik statistics and the current site on the same server under the Apache, bandwidth is the same, the impact is relatively large.

2. p2p.jpg
Around 50kb of pictures, time consuming is mostly between 1.7s~1.8s.
Picture this question, the sincerity is not my fault.
The website homepage content is rich, the picture 50kb is not too big.

Solution: Do not upgrade the bandwidth of the case, or remove the Piwik statistics, reluctant to ah, how to look at the statistical data. With Baidu statistics, the data is easily lost, such as changing the account number or a point of the problem.
It's not realistic to use less pictures or compress smaller pictures.
Not only do not want to compress, but also want to use uncompressed more clear picture miles.
In the future, we will add more pictures and show the content.
--------------------------------------------
It seems that you still need to upgrade the bandwidth 1MB to 2MB

2.55 (load:2.01s,domcontentloaded:630ms)
The effect of the upgrade bandwidth is obvious, the home load time from 4.25s to 2.55s.
This also reflects the previous analysis, bandwidth is indeed a bottleneck.

In addition, also found a problem, the server is not stable enough, should be the problem of Apache, sometimes, "have been waiting for server response."
No accident, it should be Apache did not respond, is it because the work is tired.

When you visit locally, Apache is also very slow, which is not quite right.
Now suddenly the question of the MySQL database is suspected.

MySQL and the server Apache and local Apache are not on the same machine, and their own manually installed MySQL configuration is very strong, do not understand MySQL performance optimization configuration. Do you want to spend money on cloud servers?

Originally thought, 2 hours can be the access time from 5s compressed to 2s, now it seems to be.

Eat enough, continue to optimize ~

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.